Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

ICPC 17.0.8.066 more than one instanc eof overloaded function ... matches the argument list

Brower__David
Beginner
385 Views
Test driver:

f=moreThanOne.cpp
icpc=/usr/local/packages/icc_remote/17.0.8.066/bin/icpc

wget http://raw.githubusercontent.com/martinmoene/expected-lite/master/include/nonstd/expected.hpp

g++ --version
g++ -O3 -Wall -std=c++11 -c $f

# =================================================================="

$icpc --version
$icpc -std=c++11 -c $f

-----

test program:

$ cat moreThanOne.cpp
#include "expected.hpp"
using myret = nonstd::expected<int, int>;
myret f1( int a )
{
  if( a ) return a;
  else return nonstd::make_unexpected( -1 );
}

myret f2( int a )
{
  if( a ) return a;
  else return nonstd::make_unexpected( -1 );
}

int main(int argc, char **argv)
{
  myret rv;
  rv = f1( 1 );
  rv = f2( 2 );
  return 0;
}

------

output:

g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16.0.3)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ g++ -O3 -Wall -std=c++11 -c moreThanOne.cpp
+ /usr/local/packages/icc_remote/17.0.8.066/bin/icpc --version
icpc (ICC) 17.0.8 20180907
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.

+ /usr/local/packages/icc_remote/17.0.8.066/bin/icpc -std=c++11 -c moreThanOne.cpp
expected.hpp(352): error: more than one instance of overloaded function "nonstd::expected_lite::std17::detail::is_nothrow_swappable::test" matches the argument list:
            function template "bool nonstd::expected_lite::std17::detail::is_nothrow_swappable::test<T>()"
            function template "std::false_type nonstd::expected_lite::std17::detail::is_nothrow_swappable::test<<unnamed>>(...)"
      static auto test( int ) -> std::integral_constant<bool, test<T>()>{}
                                                              ^
          detected during:
            instantiation of "nonstd::expected_lite::std17::detail::is_nothrow_swappable::test" based on template argument <int &> at line 366
            instantiation of class "nonstd::expected_lite::std17::is_nothrow_swappable<T> [with T=int &]" at line 1461
            instantiation of "std::enable_if<<expression>, void>::type nonstd::expected_lite::expected<T, E>::swap(nonstd::expected_lite::expected<T, E> &) [with T=int, E=int]" at line 1388
            instantiation of "std::enable_if<<expression>, nonstd::expected_lite::expected<T, E> &>::type nonstd::expected_lite::expected<T, E>::operator=(nonstd::expected_lite::expected<T, E> &&) [with T=int, E=int]" at line 18 of "moreThanOne.cpp"

expected.hpp(1461): error: class "nonstd::expected_lite::std17::is_nothrow_swappable<int &>" has no member "value"
          std::is_nothrow_move_constructible<T>::value && std17::is_nothrow_swappable<T&>::value &&
                                                                                           ^
          detected during:
            instantiation of "std::enable_if<<expression>, void>::type nonstd::expected_lite::expected<T, E>::swap(nonstd::expected_lite::expected<T, E> &) [with T=int, E=int]" at line 1388
            instantiation of "std::enable_if<<expression>, nonstd::expected_lite::expected<T, E> &>::type nonstd::expected_lite::expected<T, E>::operator=(nonstd::expected_lite::expected<T, E> &&) [with T=int, E=int]" at line 18 of "moreThanOne.cpp"

expected.hpp(1462): error: class "nonstd::expected_lite::std17::is_nothrow_swappable<int &>" has no member "value"
          std::is_nothrow_move_constructible<E>::value && std17::is_nothrow_swappable<E&>::value
                                                                                           ^
          detected during:
            instantiation of "std::enable_if<<expression>, void>::type nonstd::expected_lite::expected<T, E>::swap(nonstd::expected_lite::expected<T, E> &) [with T=int, E=int]" at line 1388
            instantiation of "std::enable_if<<expression>, nonstd::expected_lite::expected<T, E> &>::type nonstd::expected_lite::expected<T, E>::operator=(nonstd::expected_lite::expected<T, E> &&) [with T=int, E=int]" at line 18 of "moreThanOne.cpp"
 

 

0 Kudos
2 Replies
Viet_H_Intel
Moderator
385 Views

Thank for reporting this problem. We will investigate it and update you.

0 Kudos
Viet_H_Intel
Moderator
385 Views

I've filed this bug #CMPLRIL0-31535 internally.

0 Kudos
Reply