[LLVMbugs] [Bug 12557] New: clang crashes when a typedef shadows a forward-declared template used as a friend
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Apr 14 05:51:56 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12557
Bug #: 12557
Summary: clang crashes when a typedef shadows a
forward-declared template used as a friend
Product: clang
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: C++11
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: jonathan.sauer at gmx.de
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 8390
--> http://llvm.org/bugs/attachment.cgi?id=8390
Complete log of clang run
The following (incorrect) code crashes clang r154742:
// (the forward declaration)
template <typename>
struct Foo;
template <typename Foo_>
struct Bar {
// (added later on, after forward-declared Foo and friend declaration
below)
typedef Foo_ Foo;
// (meant was the forward-declared Foo; instead the typedef'ed Foo is used)
template <typename>
friend struct Foo;
};
struct Fubar;
struct Baz: Bar<Fubar> {
};
This results in (complete log attached):
$ ~/LLVM/build/Release+Asserts/bin/clang -v -std=c++11 clang.cpp
clang version 3.1 (trunk 154742)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
[...]
Assertion failed: (Access != AS_none && "Access specifier is AS_none inside a
record decl"), function CheckAccessDeclContext, file
/Users/rynnsauer/LLVM/llvm/tools/clang/lib/AST/DeclBase.cpp, line 669.
Clang should raise an error à la "Cannot use non-templated 'Foo' (aka 'Fubar')
in template friend declaration", with a note pointing to the typedef and
perhaps a fixit asking if the user meant the "Foo" outside the struct.
--
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