summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/anonymous-union.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add missing diagnostic for anonymous struct/union definitions that don'tRichard Smith2019-04-241-1/+1
| | | | | | introduce any names. llvm-svn: 359051
* [Sema] Fix parsing of anonymous union in language linkage specificationJan Korous2018-06-061-0/+4
| | | | | | | | | | | | | | C++17 [dcl.link]p4: A linkage specification does not establish a scope. C++17 [class.union.anon]p2: Namespace level anonymous unions shall be declared static. Differential Revision: https://reviews.llvm.org/D45884 rdar://problem/37545925 llvm-svn: 334062
* Fix half of PR26048. We don't yet diagnose the case where the anonymous ↵Richard Smith2016-01-061-2/+2
| | | | | | union member is declared first and the tag name is declared second. llvm-svn: 256979
* Improve the error message for assigning to read-only variables.Richard Trieu2015-04-111-5/+6
| | | | | | | | | | Previously, many error messages would simply be "read-only variable is not assignable" This change provides more information about why the variable is not assignable, as well as note to where the const is located. Differential Revision: http://reviews.llvm.org/D4479 llvm-svn: 234677
* Forgot to commit this change with r223975David Majnemer2014-12-101-2/+2
| | | | llvm-svn: 223979
* AST: Properly calculate the linkage of a IndirectFieldDeclDavid Majnemer2014-12-101-0/+4
| | | | | | | | | | | getLVForNamespaceScopeDecl believed that it wasn't possible for it to ever see an IndirectFieldDecl. However, this can occur when determining whether or not something is a redeclaration of a member of an anonymous static union. This fixes PR21858. llvm-svn: 223975
* Fix member refs with using decl + anonymous union.Eli Friedman2013-07-161-0/+9
| | | | | | | | | | Make sure we call BuildFieldReferenceExpr with the appropriate decl when a member of an anonymous union is made public with a using decl. Also, fix a crash on invalid field access into an anonymous union. Fixes PR16630. llvm-svn: 186367
* Add missing diagnostic for a nested-name-specifier on a free-standing type ↵Richard Smith2013-03-181-1/+1
| | | | | | definition. Bump some related diagnostics from warning to extension in C++, since they're errors there. Add some missing checks for function specifiers on non-function declarations. llvm-svn: 177335
* Clarify the diagnostic for -Wnested-anon-types.Richard Smith2013-01-311-5/+5
| | | | llvm-svn: 174032
* Add a -pedantic warning: an anonymous union within an anonymous union is notRichard Smith2013-01-281-5/+5
| | | | | | | permitted in standard C++, despite being silently accepted by many (all?) major C++ implementations. llvm-svn: 173643
* Ignore const/volatile/restrict qualifiers on anonymous structs andDouglas Gregor2011-05-091-4/+26
| | | | | | unions. Fixes PR8326. llvm-svn: 131109
* Fix bogus compiler errors when declaring anonymous union, outside a class, withArgyrios Kyrtzidis2010-09-231-0/+20
| | | | | | | members with the same name as a decl outside the scope where the members are actually introduced. Fixes http://llvm.org/PR6741 llvm-svn: 114641
* Propagate access specifiers to anonymous union members nested within classes.John McCall2010-05-211-0/+34
| | | | | | Fixes <rdar://problem/7987650>. llvm-svn: 104376
* Downgrade the "declaration does not declare anything" error to aDouglas Gregor2010-04-081-1/+1
| | | | | | | warning. It's not harmful to have such pointless declarations, and GCC does not diagnose this issue consistently. llvm-svn: 100814
* Patch fixes a lookup bug in c++'s anonymous union memberFariborz Jahanian2010-01-221-0/+10
| | | | | | lookup. Fixes radar 7562438. llvm-svn: 94191
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Implement support for anonymous structs and unions in C. Both C andDouglas Gregor2009-01-121-0/+3
| | | | | | | | | | | | | | C++ handle anonymous structs/unions in the same way. Addresses several bugs: <rdar://problem/6259534> <rdar://problem/6481130> <rdar://problem/6483159> The test case in PR clang/1750 now passes with -fsyntax-only, but CodeGen for inline assembler still fails. llvm-svn: 62112
* Unify the code for defining tags in C and C++, so that we alwaysDouglas Gregor2009-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce a Scope for the body of a tag. This reduces the number of semantic differences between C and C++ structs and unions, and will help with other features (e.g., anonymous unions) in C. Some important points: - Fields are now in the "member" namespace (IDNS_Member), to keep them separate from tags and ordinary names in C. See the new test in Sema/member-reference.c for an example of why this matters. In C++, ordinary and member name lookup will find members in both the ordinary and member namespace, so the difference between IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but only in C++!). - We always introduce a Scope and push a DeclContext when we're defining a tag, in both C and C++. Previously, we had different actions and different Scope/CurContext behavior for enums, C structs/unions, and C++ structs/unions/classes. Now, it's one pair of actions. (Yay!) There's still some fuzziness in the handling of struct/union/enum definitions within other struct/union/enum definitions in C. We'll need to do some more cleanup to eliminate some reliance on CurContext before we can solve this issue for real. What we want is for something like this: struct X { struct T { int x; } t; }; to introduce T into translation unit scope (placing it at the appropriate point in the IdentifierResolver chain, too), but it should still have struct X as its lexical declaration context. PushOnScopeChains isn't smart enough to do that yet, though, so there's a FIXME test in nested-redef.c llvm-svn: 61940
* Finished semantic analysis of anonymous unions in C++.Douglas Gregor2009-01-071-4/+15
| | | | | | | | | Duplicate-member checking within classes is still a little messy, and anonymous unions are still completely broken in C. We'll need to unify the handling of fields in C and C++ to make this code applicable in both languages. llvm-svn: 61878
* Test case for anonymous unions in C++Douglas Gregor2009-01-071-0/+99
llvm-svn: 61860
OpenPOWER on IntegriCloud