[LLVMbugs] [Bug 12455] New: declaration in statement expression in decltype is bad news

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 3 21:02:00 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12455

             Bug #: 12455
           Summary: declaration in statement expression in decltype is bad
                    news
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    richard-llvm at metafoo.co.uk
    Classification: Unclassified


Ahem:

  namespace N { class C { void f(decltype(({int i; i;}));)};}

I'm terribly sorry, please come back. The proximate error is

clang: DeclBase.cpp:669: void clang::Decl::CheckAccessDeclContext() const:
Assertion `Access != AS_none && "Access specifier is AS_none inside a record
decl"' failed.

while calling R.addDecl(ND) where ND is the 'i;' statement. For 'i',
DeclContext == LexicalDeclContext == class C.

A related issue is this:

  void foo() {
    enum class C {
      k = decltype(({ void bar(); 0; }))()
    };
    C::bar();
  }

which is an amazing accepts-invalid where we use the preceding insight to add a
method to an enum class. Whee!

-- 
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