[LLVMbugs] [Bug 5264] New: clang mistakens a complete template type for an incomplete type when its reference was used before its definition
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Tue Oct 20 20:56:52 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=5264
Summary: clang mistakens a complete template type for an
incomplete type when its reference was used before its
definition
Product: clang
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Semantic Analyzer
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: zhanyong.wan at gmail.com
CC: llvmbugs at cs.uiuc.edu
$ cat test.cc
template <typename T> class Foo;
Foo<int>* v;
Foo<int>& F() { return *v; }
template <typename T> class Foo {};
Foo<int> x;
$ clang-cc -fsyntax-only test.cc
test.cc:5:10: error: invalid use of incomplete type 'Foo<int>'
Foo<int> x;
^
test.cc:1:29: note: forward declaration of 'class Foo<int>'
template <typename T> class Foo;
This prevents clang from parsing Google Test.
Note that the following code, which doesn't involve templates, doesn't trigger
the bug:
class Bar;
Bar* b;
Bar& Func() { return *b; }
class Bar {};
Bar y;
--
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