Created attachment 32255 [details] (unpreprocessed) source $ g++ -v Reading specs from /ms/dist/fsf/PROJ/gcc/4.8.1/.exec/@sys/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/specs COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/ms/dist/fsf/PROJ/gcc/4.8.1/.exec/@sys/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: //ms/dev/fsf/gcc/4.8.1/src/gcc-4.8.1/configure --prefix=//ms/dist/fsf/PROJ/gcc/4.8.1/.exec/x86_64.linux.2.6.glibc.2.3 --exec-prefix=//ms/dist/fsf/PROJ/gcc/4.8.1/.exec/x86_64.linux.2.6.glibc.2.3 --disable-checking --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,fortran --with-gmp=//ms/dev/fsf/gcc/4.8.1/install/.exec/x86_64.linux.2.6.glibc.2.3 --with-mpfr=//ms/dev/fsf/gcc/4.8.1/install/.exec/x86_64.linux.2.6.glibc.2.3 --with-mpc=//ms/dev/fsf/gcc/4.8.1/install/.exec/x86_64.linux.2.6.glibc.2.3 --enable-linker-build-id --with-cloog=//ms/dev/fsf/gcc/4.8.1/install/.exec/x86_64.linux.2.6.glibc.2.3 --with-isl=//ms/dev/fsf/gcc/4.8.1/install/.exec/x86_64.linux.2.6.glibc.2.3 --with-gnu-as --with-gnu-ld Thread model: posix gcc version 4.8.1 (GCC) $ g++ -std=c++11 ambiguous.cpp ambiguous.cpp: In instantiation of 'void f(const char*, T ...) [with T = {int}]': ambiguous.cpp:12:14: required from here ambiguous.cpp:7:51: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default] f(const_cast<char*>(s), std::forward<T>(args)...); ^ ambiguous.cpp:6:6: note: candidate 1: void f(const char*, T ...) [with T = {int}] void f(const char* s, T... args) { ^ ambiguous.cpp:3:6: note: candidate 2: void f(char*, ...) void f(char* s, ...) {} ^
Created attachment 32256 [details] preprocessed source
No, this is not related to bug 58156. According to the current core language of C++11, the code is indeed ambiguous. There exists currently a core language issue to fix that, see http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1395
[Moved to DR at the November, 2016 meeting.] (In reply to Daniel Krügler from comment #2) > No, this is not related to bug 58156. According to the current core language > of C++11, the code is indeed ambiguous. > > There exists currently a core language issue to fix that, see > > http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1395 Hmm, but this example is still rejected in both GCC and clang (and MSVC) but accepted for ICC. The example in both defect reports is done correctly with GCC and all.