Patch for constexpr variable templates
Braden Obrzut
admin@maniacsvault.net
Fri Aug 1 10:21:00 GMT 2014
On 07/31/2014 08:53 AM, Jason Merrill wrote:
> In the original mail you mentioned doing it in cp_parser_template_id;
> I agree that we probably don't want to do it there because of the
> complications you are seeing. I was thinking about doing it when we
> normally resolve an id-expression that refers to a variable, once we
> know we're looking at an expression and not a declarator-id. But I
> think my suggestion of cp_parser_id_expression was wrong, and it would
> be better in finish_id_expression.
>
> Jason
>
Ahh sorry, I misread the function name you gave. finish_id_expression
works just fine and doesn't require any extra work. How does this patch
look?
- Braden Obrzut
2014-08-01 Braden Obrzut <admin@maniacsvault.net>
* 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 (determine_specialization): Accept variable templates.
(check_template_variable): Fixed wanted template header count and
change non static data member error to variable template warning.
(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.
2014-08-01 Braden Obrzut <admin@maniacsvault.net>
* g++.dg/cpp1y/var-templ1.C: New.
* g++.dg/cpp1y/var-templ2.C: New.
* g++.dg/cpp1y/var-templ3.C: New.
* g++.dg/cpp1y/var-templ4.C: New.
* g++.dg/cpp1y/var-templ5.C: New.
* g++.dg/cpp1y/pr59638.C: Marked xfail for template variables as
function pointers taking auto are considered templates at the moment.
* g++.dg/parse/error50.C: Malformed statements look like variable
templ.
* g++.dg/template/crash71.C: Looks like variable templ.
* g++.old-deja/g++.oliva/template10.C: Looks like variable templ.
* g++.old-deja/g++.pt/var1.C: Non-constexpr variable templ.
2013-03-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
* cp-tree.h (variable_template_p): Do not check scope.
* pt.c (check_template_variable): Fix thinko from previous change.
(push_template_decl_real): Fix formatting.
2013-03-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
* cp-tree.h (variable_template_p): New.
* 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: var-templ.diff
Type: text/x-patch
Size: 20217 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140801/2a951162/attachment.bin>
More information about the Gcc-patches
mailing list