[LLVMbugs] [Bug 7409] New: Extra errors after bad typedef
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jun 18 10:10:58 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7409
Summary: Extra errors after bad typedef
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Keywords: quality-of-implementation
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: jyasskin at google.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
When we write a typedef with a bad type, and then use the defined name later,
clang treats that name as 'int', which causes extra error spew. Instead, it
should treat the name as an erroneous type and suppress any errors involving
it.
$ cat test.cc
struct BaseReturn {};
template<typename T> struct Foo {
typedef typename T::foo foo;
typedef typename foo::bar bar;
};
Foo<long> f;
$ ./clang++ -fsyntax-only test.cc
test.cc:3:20: error: type 'long' cannot be used prior to '::' because it has no
members
typedef typename T::foo foo;
^
test.cc:7:11: note: in instantiation of template class 'Foo<long>' requested
here
Foo<long> f;
^
test.cc:4:20: error: type 'foo' (aka 'int') cannot be used prior to '::'
because it has no members
typedef typename foo::bar bar;
^
2 errors generated.
Note the "(aka 'int')", which is completely wrong.
A second, more minor problem, is that in the first error, it complains about
'long' but points at 'T', and I've seen a user get confused about what type it
was actually talking about. Using 'T' (aka 'long') might help (but might also
bloat more complex messages).
--
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