[Bug c++/27560] New: template function not recognized when invoked with enum defined in function

ian at airs dot com gcc-bugzilla@gcc.gnu.org
Thu May 11 15:43:00 GMT 2006


Compiling this file, with mainline, gcc 4.0, or 4.1

template<typename t> void f(t a) { }
void g() { enum e { v }; f(v); }

gives this error message:

foo.cc: In function ‘void g()’:
foo.cc:2: error: no matching function for call to ‘f(g()::e)’

If the enum definition is moved out of the function, this works.  With gcc 3.2,
this works.  I didn't try 3.4.

My C++ fu is weak, and I do not know for sure that this is valid C++, although
I don't see anything wrong with it.  But either 1) it is valid and gcc should
accept it, or 2) gcc should provide a list of candidates which did not match,
since there is manifestly a function named 'f'.


-- 
           Summary: template function not recognized when invoked with enum
                    defined in function
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ian at airs dot com


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



More information about the Gcc-bugs mailing list