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

            Bug ID: 59135
           Summary: Incorrect ambiguity in constexpr function overloads
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vexocide at gmail dot com

Created attachment 31220
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31220&action=edit
minimal example

Using built-in specs.
COLLECT_GCC=g++-mp-4.8
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin13/4.8.2/lto-wrapper
Target: x86_64-apple-darwin13
Configured with:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc48/gcc48/work/gcc-4.8.2/configure
--prefix=/opt/local --build=x86_64-apple-darwin13
--enable-languages=c,c++,objc,obj-c++,lto,fortran,java
--libdir=/opt/local/lib/gcc48 --includedir=/opt/local/include/gcc48
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datarootdir=/opt/local/share/gcc-4.8 --with-local-prefix=/opt/local
--with-system-zlib --disable-nls --program-suffix=-mp-4.8
--with-gxx-include-dir=/opt/local/include/gcc48/c++/ --with-gmp=/opt/local
--with-mpfr=/opt/local --with-mpc=/opt/local --with-cloog=/opt/local
--enable-cloog-backend=isl --disable-cloog-version-check
--enable-stage1-checking --disable-multilib --enable-lto
--enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld
--with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket
--with-pkgversion='MacPorts gcc48 4.8.2_0'
Thread model: posix
gcc version 4.8.2 (MacPorts gcc48 4.8.2_0)

g++-mp-4.8 test.cpp -o test -std=c++11 -Wall -Wextra -Wno-unused-parameter     
                                                                               
                                                 0 s050414t 16:39
test.cpp: In function 'int main(int, char**)':
test.cpp:22:28: error: call of overloaded 'bar(foo<int>, int, int)' is
ambiguous
     bar<0>(foo<int>(), 1, 2);
                            ^
test.cpp:22:28: note: candidates are:
test.cpp:9:16: note: constexpr bool bar(T&&, Us&& ...) [with long unsigned int
N = 0ul; T = foo<int>; Us = {int, int}]
 constexpr bool bar(T && t, Us &&... us)
                ^
test.cpp:15:16: note: constexpr bool bar(foo<T>&&, Us&& ...) [with long
unsigned int N = 0ul; T = int; Us = {int, int}]
 constexpr bool bar(foo<T> && t, Us &&... us)
                ^

clang++-mp-3.4 test.cpp -o test -std=c++11 -Wall -Wextra -Wno-unused-parameter
compiles the example as expected.

Reply via email to