http://llvm.org/bugs/show_bug.cgi?id=8119
Summary: missing typename in function prototype is parsed as
variable declaration
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
This code snippet is invalid and is rejected by both gcc and clang:
template <typename A>
class Map {
public:
class Iterator {
};
};
template <typename S>
void f1(Map<S>::Iterator v) {
}
but what's wrong? Let's ask clang:
test.cc:9:6: error: variable 'f1' declared as a template
void f1(Map<S>::Iterator v) {
^
test.cc:9:27: error: expected ')'
void f1(Map<S>::Iterator v) {
^
test.cc:9:8: note: to match this '('
void f1(Map<S>::Iterator v) {
^
test.cc:9:29: error: expected ';' at end of declaration
void f1(Map<S>::Iterator v) {
^
;
test.cc:9:30: error: expected unqualified-id
void f1(Map<S>::Iterator v) {
^
4 errors generated.
This is a terrible diagnostic. It sounds like things go wrong when clang
decides that f1 is a variable instead of a function. The desired diagnostic is
the fixit that says where to insert 'typename' before Map.
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs