http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60402

            Bug ID: 60402
           Summary: const overload with variadics declared ambiguous
                    according to standard (may be related to bug 58156)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nate.mcnamara at morganstanley dot com

Created attachment 32255
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32255&action=edit
preprocessed 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, ...) {}
      ^

Reply via email to