[LLVMbugs] [Bug 10672] New: Unhelpful error message for out-of-line definition of template class's member function template
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Aug 16 06:08:08 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10672
Summary: Unhelpful error message for out-of-line definition of
template class's member function template
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: david at rothlis.net
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
For the following invalid C++ code:
template <typename T>
struct A {
template <typename U>
void f();
};
template <typename T, typename U>
void A<T>::f() { }
Clang's error message is:
test.cpp:6:1: error: too many template parameters in template redeclaration
template <typename T, typename U>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cpp:1:1: note: previous template declaration is here
template <typename T>
^~~~~~~~~~~~~~~~~~~~~
test.cpp:7:12: error: out-of-line definition of 'f' does not match any
declaration in 'A<T>'
void A<T>::f() {
~~~~~~^
2 errors generated.
GCC's error message is actually much *more* helpful:
test.cpp:7: error: prototype for ‘void A<T>::f()’ does not match any in class
‘A<T>’
test.cpp:4: error: candidate is: template<class T> template<class U> void
A::f()
test.cpp:7: error: template definition of non-template ‘void A<T>::f()’
in that it shows the desired syntax: template<class T> template <class U> void
A::f() { ...
Most people are unlikely to get this syntax right on the first try, so I think
the error message is important.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list