[LLVMbugs] [Bug 11856] New: Bad diagnostic when member reference collides with global template function
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jan 25 13:36:01 PST 2012
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: unassignedclangbugs at nondot.org
ReportedBy: jyasskin at google.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
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.
More information about the llvm-bugs
mailing list