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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to