https://bugs.llvm.org/show_bug.cgi?id=40178

            Bug ID: 40178
           Summary: c11: Rejects well-formed program with alignment
                    specifier in typename of compound literal.
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: anders.granlun...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

Test case (prog.c):

  int main()
  {
    (_Alignas (int) int) { 0 };
  }

Compilation command line:

  clang prog.c -Wall -Wextra -std=c11 -pedantic-errors

Observed behaviour:

  The following error message was outputed:

    prog.c:3:6: error: expected expression
        (_Alignas (int) int) { 0 };
         ^
    1 error generated.

Expected behaviour:

  No error messages outputed.

  The program is well-formed. See 6.7.5/1:

    "An alignment specifier shall appear only in the declaration specifiers of
a
     declaration, or in the specifier-qualifier list  of  a  member
declaration,   
     or  in  the  type  name  of  a  compound  literal.   An alignment
specifier
     shall not be used in conjunction with either of the storage-class
     specifiers typedef or register, nor in a declaration of a function or
     bit-field."

Note:

  GCC accepts this program without any error messages outputed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to