[Bug c++/69572] New: [C++11] invalid alignas accepted in many contexts

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 30 23:39:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69572

            Bug ID: 69572
           Summary: [C++11] invalid alignas accepted in many contexts
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

Besides the corner case in bug 69571, the latest trunk of 6.0 (and all prior
version that support the keyword) accepts without a warning all of the
following invalid constructs in both C++11 and C++14 modes.  Clang rejects them
all.

$ cat z.c && /home/msebor/build/gcc-trunk-svn/gcc/xgcc
-B/home/msebor/build/gcc-trunk-svn/gcc -S -Wall -Wextra -Wpedantic -std=c++11
-xc++ z.c
typedef struct A {
    alignas (4) int c:1;
    alignas (4) A () {
        register int i alignas (4);
        (void)i;
    }
    template <class T>
    void foo (alignas (T) int);

    alignas (4) int bar ();
    enum E { } alignas (4);
} A;

$


More information about the Gcc-bugs mailing list