From a6e8b685e13492abfb2e58dc49007deda165a00d Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 4 Sep 2019 20:30:37 +0000 Subject: [c++20] P1143R2: Add support for the C++20 'constinit' keyword. This is mostly the same as the [[clang::require_constant_initialization]] attribute, but has a couple of additional syntactic and semantic restrictions. In passing, I added a warning for the attribute form being added after we have already seen the initialization of the variable (but before we see the definition); that case previously slipped between the cracks and the attribute was silently ignored. llvm-svn: 370972 --- clang/lib/Parse/ParseDeclCXX.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/lib/Parse/ParseDeclCXX.cpp') diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index cf03ed6379c..529c09a50e7 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -1313,6 +1313,8 @@ bool Parser::isValidAfterTypeSpecifier(bool CouldBeBitfield) { case tok::kw_mutable: // struct foo {...} mutable x; case tok::kw_thread_local: // struct foo {...} thread_local x; case tok::kw_constexpr: // struct foo {...} constexpr x; + case tok::kw_consteval: // struct foo {...} consteval x; + case tok::kw_constinit: // struct foo {...} constinit x; // As shown above, type qualifiers and storage class specifiers absolutely // can occur after class specifiers according to the grammar. However, // almost no one actually writes code like this. If we see one of these, -- cgit v1.2.3