Implement constexpr variable templates
commit4a4f287dc1ae6f111b28edfe9affe63506f38f29
authorBraden Obrzut <admin@maniacsvault.net>
Tue, 5 Aug 2014 18:24:06 +0000 (5 18:24 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 5 Aug 2014 18:24:06 +0000 (5 14:24 -0400)
tree2904c8e428452b63c7ee221d28f8d8dfa942d509
parentd406ae470c795e301bc3e0ab6326e9091c0137d4
Implement constexpr variable templates

Implement constexpr variable templates
* decl.c (grokvardecl): Handle specializations of variable templates.
(grokdeclarator): Handle variable template id expressions and NULL_TREE
return from grokvardecl.
* decl2.c (check_member_template): Allow declaration of template member
variables.
* parser.c (cp_parser_template_id): Build a TEMPLATE_ID_EXPR for
variable templates.
* pt.c (check_template_variable): Accept variable temploids at
non-class scope.
(push_template_decl_real): The current instantiation of a template
can be a VAR_DECL.
(determine_specialization): Accept variable templates.
(check_explicit_specialization): Handle and check for malformed
variable template specializations.
(lookup_template_variable): New.
(tsubst_decl): Handle variable template specializations.
(do_decl_instantiation): Handle template variables.
(instantiate_decl): Handle template variables.
* semantics.c (finish_template_variable): New.
(finish_id_expression): Instantiate variable templates.
* cp-tree.h (variable_template_p): New.

From-SVN: r213641
17 files changed:
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/testsuite/g++.dg/cpp1y/pr59638.C
gcc/testsuite/g++.dg/cpp1y/var-templ1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/var-templ2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/var-templ3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/var-templ4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/var-templ5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/parse/error50.C
gcc/testsuite/g++.dg/template/crash71.C
gcc/testsuite/g++.old-deja/g++.oliva/template10.C
gcc/testsuite/g++.old-deja/g++.pt/var1.C