[llvm-bugs] [Bug 40178] New: c11: Rejects well-formed program with alignment specifier in typename of compound literal.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 28 15:03:29 PST 2018


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: unassignedclangbugs at nondot.org
          Reporter: anders.granlund.0 at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181228/9a660bc0/attachment.html>


More information about the llvm-bugs mailing list