summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/static-assert.c
Commit message (Collapse)AuthorAgeFilesLines
* [c++20] Implement semantic restrictions for C++20 designatedRichard Smith2019-08-301-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initializers. This has some interesting interactions with our existing extensions to support C99 designated initializers as an extension in C++. Those are resolved as follows: * We continue to permit the full breadth of C99 designated initializers in C++, with the exception that we disallow a partial overwrite of an initializer with a non-trivially-destructible type. (Full overwrite is OK, because we won't run the first initializer at all.) * The C99 extensions are disallowed in SFINAE contexts and during overload resolution, where they could change the meaning of valid programs. * C++20 disallows reordering of initializers. We only check for that for the simple cases that the C++20 rules permit (designators of the form '.field_name =' and continue to allow reordering in other cases). It would be nice to improve this behavior in future. * All C99 designated initializer extensions produce a warning by default in C++20 mode. People are going to learn the C++ rules based on what Clang diagnoses, so it's important we diagnose these properly by default. * In C++ <= 17, we apply the C++20 rules rather than the C99 rules, and so still diagnose C99 extensions as described above. We continue to accept designated C++20-compatible initializers in C++ <= 17 silently by default (but naturally still reject under -pedantic-errors). This is not a complete implementation of P0329R4. In particular, that paper introduces new non-C99-compatible syntax { .field { init } }, and we do not support that yet. This is based on a previous patch by Don Hinton, though I've made substantial changes when addressing the above interactions. Differential Revision: https://reviews.llvm.org/D59754 llvm-svn: 370544
* Replace some custom C11 extension warnings with the generic warning.Aaron Ballman2019-08-271-13/+23
| | | | llvm-svn: 370066
* Reland r348741 "[Sema] Further improvements to to static_assert diagnostics."Clement Courbet2018-12-111-1/+1
| | | | | | Fix a dangling reference to temporary, never return nullptr. llvm-svn: 348834
* Revert r348741 "[Sema] Further improvements to to static_assert diagnostics."Clement Courbet2018-12-101-1/+1
| | | | | | Seems to break build bots. llvm-svn: 348742
* [Sema] Further improvements to to static_assert diagnostics.Clement Courbet2018-12-101-1/+1
| | | | | | | | | | | | | | Summary: We're now handling cases like `static_assert(!expr)` and static_assert(!(expr))`. Reviewers: aaron.ballman, Quuxplusone Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55270 llvm-svn: 348741
* Enable use of _Static_assert inside structs and unions in C11 mode (as per ↵Andy Gibbs2013-04-031-2/+31
| | | | | | C11 6.7.2.1p1). llvm-svn: 178632
* Made the "expected string literal" diagnostic more expressiveAndy Gibbs2012-11-171-0/+2
| | | | llvm-svn: 168267
* C1X: implement static assertsPeter Collingbourne2011-04-151-0/+11
llvm-svn: 129555
OpenPOWER on IntegriCloud