[LLVMbugs] [Bug 13716] New: alignas is accepted on typedefs

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 28 11:02:38 PDT 2012


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

             Bug #: 13716
           Summary: alignas is accepted on typedefs
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dblaikie at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Clang accepts the following ill-formed code:

    typedef char alignas(int) A;
    typedef char alignas(3) B;

This is invalid per 7.6.2[dcl.align]p1:

    "An alignment-specifier may be applied to a variable or to a class data
member ... An alignment-specifier may also be applied to the declaration of a
class or enumeration type. ..."

GCC 4.7 correctly rejects these constructs (though without the most elegant
diagnostics):

    alignas.cpp:1:27: error: expected initializer before ‘A1’
    alignas.cpp:2:21: error: typedef ‘alignas’ is initialized (use decltype
instead)

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