Marek Polacek
4742dbe718
PR c++/91360 - Implement C++20 P1143R2: constinit.
* c-common.c (c_common_reswords): Add constinit and __constinit. (keyword_is_decl_specifier): Handle RID_CONSTINIT. * c-common.h (enum rid): Add RID_CONSTINIT, RID_FIRST_CXX20, and RID_LAST_CXX20. (D_CXX20): Define. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_constinit. * c-format.c (cxx_keywords): Add "constinit". * c.opt (Wc++2a-compat, Wc++20-compat): New options. * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define. (LOOKUP_CONSTINIT): Define. (enum cp_decl_spec): Add ds_constinit. * decl.c (check_tag_decl): Give an error for constinit in type declarations. (check_initializer): Also check LOOKUP_CONSTINIT. (cp_finish_decl): Add checking for a constinit declaration. Set TINFO_VAR_DECLARED_CONSTINIT. (grokdeclarator): Add checking for a declaration with the constinit specifier. * lex.c (init_reswords): Handle D_CXX20. * parser.c (cp_lexer_get_preprocessor_token): Pass a better location to warning_at. Warn about C++20 keywords. (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT. (cp_parser_diagnose_invalid_type_name): Add an inform about constinit. (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl. (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT. (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl. (set_and_check_decl_spec_loc): Add "constinit". * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT. (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl. * typeck2.c (store_init_value): If a constinit variable wasn't initialized using a constant initializer, give an error. * doc/invoke.texi: Document -Wc++20-compat. * g++.dg/cpp2a/constinit1.C: New test. * g++.dg/cpp2a/constinit2.C: New test. * g++.dg/cpp2a/constinit3.C: New test. * g++.dg/cpp2a/constinit4.C: New test. * g++.dg/cpp2a/constinit5.C: New test. * g++.dg/cpp2a/constinit6.C: New test. * g++.dg/cpp2a/constinit7.C: New test. * g++.dg/cpp2a/constinit8.C: New test. * g++.dg/cpp2a/constinit9.C: New test. * g++.dg/cpp2a/constinit10.C: New test. * g++.dg/cpp2a/constinit11.C: New test. * g++.dg/cpp2a/constinit12.C: New test. From-SVN: r275008
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.
Description
Languages
C
48%
Ada
18.3%
C++
14.1%
Go
7%
GCC Machine Description
4.6%
Other
7.7%