http://llvm.org/bugs/show_bug.cgi?id=11856
Bug #: 11856
Summary: Bad diagnostic when member reference collides with
global template function
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
In the following program, Foo() is trying to use a public member variable of
"*it1". Because there's a global template with the same name, it interprets the
subsequent '<' as starting a template instantiation, and then finds trouble
many tokens later when there's no matching '>'.
$ cat test.ii
template<typename T> T end(T);
template <typename T>
void Foo() {
T it1;
if (it1->end < it1->end) {
}
}
$ clang -fsyntax-only test.ii
test.ii:6:26: error: expected '>'
if (it1->end < it1->end)
^
test.ii:6:26: error: expected unqualified-id
2 errors generated.
$
The error should at least mention the template it was trying to find a
parameter for.
A possible fixit is to add parentheses around "it1->end".
This will come up more often in C++11, where there's a std::end<>() that lots
of people will 'using' into their global namespaces.
--
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