diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-28 00:54:05 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-28 00:54:05 +0000 |
commit | c5f7d6aed586fc492383255633c7ea5591256bfe (patch) | |
tree | 30a47e5d260693b873bac914ba7df594c8bc5f17 /lib/Sema/SemaDecl.cpp | |
parent | c37b183e72ea62d654ec9e02d8e8d996a6014d3c (diff) |
Add a -pedantic warning: an anonymous union within an anonymous union is not
permitted in standard C++, despite being silently accepted by many (all?) major
C++ implementations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173643 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 136d12ebc3..a5f39a82f1 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3198,6 +3198,12 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, << (int)Record->isUnion(); Invalid = true; } + } else { + // This is an anonymous type definition within another anonymous type. + // This is a popular extension, provided by Plan9, MSVC and GCC, but + // not part of standard C++. + Diag(MemRecord->getLocation(), + diag::ext_anonymous_record_with_anonymous_type); } } else if (isa<AccessSpecDecl>(*Mem)) { // Any access specifier is fine. |