From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 771 invoked by alias); 11 May 2006 15:43:57 -0000 Received: (qmail 753 invoked by uid 48); 11 May 2006 15:43:49 -0000 Date: Thu, 11 May 2006 15:43:00 -0000 Subject: [Bug c++/27560] New: template function not recognized when invoked with enum defined in function X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ian at airs dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-05/txt/msg01125.txt.bz2 List-Id: Compiling this file, with mainline, gcc 4.0, or 4.1 template 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