[llvm-bugs] [Bug 51112] New: __extension__ does not suppress pedantic -Wnested-anon-types diagnostic

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 16 03:17:55 PDT 2021


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

            Bug ID: 51112
           Summary: __extension__ does not suppress pedantic
                    -Wnested-anon-types diagnostic
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zilla at kayari.org
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Compiling this with -Wpedantic gives a warning:

struct S
{
  union
  {
    __extension__ struct
    {
      int i;
      int j;
    };
    long l;
  };
};

anon.cc:5:19: warning: anonymous types declared in an anonymous union are an
extension [-Wnested-anon-types]
    __extension__ struct
                  ^
1 warning generated.

It would be nice if the __extension__ keyword suppressed the warning here, as
it does for GCC's equivalent warning:

anon.cc:6:5: warning: ISO C++ prohibits anonymous structs [-Wpedantic]

-- 
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/20210716/00bc94a8/attachment.html>


More information about the llvm-bugs mailing list