This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/21066] New: Regression: template argument deduction finds false ambiguity

The attached code has compiled fine for several years on g++, and compiles on
the Compaq CXX compiler. It recently gives the following:

/usr/local/bin/g++ -c -g -fno-elide-constructors       -pedantic-errors -Werror
-ansi -fno-common -fstrict-aliasing -Wall -Wold-style-cast -Wsign-promo
-Wpointer-arith -Wconversion -Wundef -Wwrite-strings -Winvalid-pch
-Woverloaded-virtual -Wcast-qual -Wextra -Wredundant-decls -Wshadow -MMD     
-fimplicit-templates -o stest.o In function 'int main(int, char**)': error: call of overloaded 'muv(const functor_t&, int
(functor_t::*)()const)' is ambiguous note: candidates are: int muv(T&, int (T::*)()) [with T = const
functor_t] note:                 int muv(const T&, int (T::*)()const) [with T
= functor_t]
gmake: *** [stest.o] Error 1

It looks like a type of const functor_t causes int (T::*)() to be interpreted as
int (T::*)()const.

Even if this represents a new check, and is valid, why doesn't the compiler also
complain about an ambiguity with the third form, int muv(T&, int (T::*)()const?

alpha1:PD>g++ -v
Using built-in specs.
Target: alphaev56-unknown-linux-gnu
Configured with: ../gcc/configure --verbose --enable-languages=c++ --disable-nls
Thread model: posix
gcc version 4.1.0 20050409 (experimental)

alias CONFIGURECVS='../gcc/configure --verbose --enable-languages=c++
--disable-nls >clog 2>&1 &'

alias BUILD='nice gmake CFLAGS='\'''\'' BOOT_CFLAGS='\'''\''
LIBCFLAGS='\''-g'\'' LIBCXXFLAGS='\''-g'\'' bootstrap >log 2>&1 &'

           Summary: Regression: template argument deduction finds false
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mckelvey at maskull dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: alphaev56-unknown-linux-gnu
  GCC host triplet: alphaev56-unknown-linux-gnu
GCC target triplet: alphaev56-unknown-linux-gnu

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]