[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-bugs
Subject: [Bug c++/47929] New: unclear "prototype for '...' does not match any in class" diagnostic for templa
From: "redi at gcc dot gnu.org" <gcc-bugzilla () gcc ! gnu ! org>
Date: 2011-02-28 18:39:29
Message-ID: bug-47929-4 () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47929
Summary: unclear "prototype for '...' does not match any in
class" diagnostic for templates
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: redi@gcc.gnu.org
Given the invalid code:
struct S
{
void f();
};
template<typename T>
void S::f()
{
}
G++ complains:
x.cc:7:6: error: prototype for 'void S::f()' does not match any in class 'S'
x.cc:3:10: error: candidate is: void S::f()
The error message doesn't indicate that one of the signatures is a template, it
might be helpful if it did.
(I have just spent about a minute being dumb and confused because the line with
"template<typename T>" was scrolled off the top of my editor window and I
couldn't see why the signatures didn't match!)
If the situation is reversed, so the declaration is a template but the
definition is not, the error message makes it obvious:
x.cc:7:6: error: prototype for 'void S::f()' does not match any in class 'S'
x.cc:4:12: error: candidate is: template<class T> void S::f()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic