This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH to support non-constexpr variable templates
- From: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 25 Aug 2014 22:15:53 +0300
- Subject: Re: C++ PATCH to support non-constexpr variable templates
- Authentication-results: sourceware.org; auth=none
- References: <CAFk2RUaCvOsUZOqRN7jM+mj3QU16Pv4gaDfW0icbNK70-F_qdQ at mail dot gmail dot com> <53FAA54B dot 4000902 at redhat dot com> <CAFk2RUa=STZYVpw1XO=qr7O7+4UNYzbVrX7bi9uWPkXf+gDteQ at mail dot gmail dot com> <53FB305E dot 1040901 at redhat dot com> <l5ij9h dot nav8m8 dot 2yoola-qmf at mx dot google dot com>
On 25 August 2014 17:08, <ville.voutilainen@gmail.com> wrote:
>> Anyway, here's a fix for your recent test.
>
> Thanks, I'll take a look at the tests and will send a patch if something seems missing; static member variable templates of a class template and explicit specializations thereof are the likely starting point.
Another ICE (should we just add these test-for-valid cases as new
tests? Or should they become
bug reports instead? Please advise how to best handle these.):
template <class T>
struct Y
{
template <class U> static U x;
};
template <class T>
template <class U>
U Y<T>::x = U();
int main()
{
int y = Y<int>::x<int>;
}
variable-template.cpp:9:3: warning: too many template headers for
Y<T>::x (should be 1)
U Y<T>::x = U();
^
variable-template.cpp: In instantiation of âint Y<int>::xâ:
variable-template.cpp:13:19: required from here
variable-template.cpp:13:19: internal compiler error: in
template_for_substitution, at cp/pt.c:19714
int y = Y<int>::x<int>;
^
0x5c4bf9 template_for_substitution(tree_node*)
../../gcc/cp/pt.c:19714
0x5d0874 instantiate_decl(tree_node*, int, bool)
../../gcc/cp/pt.c:19891
0x6521c2 mark_used(tree_node*, int)
../../gcc/cp/decl2.c:5035
0x707f5b finish_id_expression(tree_node*, tree_node*, tree_node*,
cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**,
unsigned int)
../../gcc/cp/semantics.c:3515
0x67f13b cp_parser_primary_expression
../../gcc/cp/parser.c:4654
0x6804e7 cp_parser_postfix_expression
../../gcc/cp/parser.c:6008
0x6832b9 cp_parser_unary_expression
../../gcc/cp/parser.c:7285
0x683ef4 cp_parser_binary_expression
../../gcc/cp/parser.c:8028
0x68449b cp_parser_assignment_expression
../../gcc/cp/parser.c:8270
0x684935 cp_parser_assignment_expression
../../gcc/cp/parser.c:8320
0x684935 cp_parser_constant_expression
../../gcc/cp/parser.c:8524
0x69557e cp_parser_init_declarator
../../gcc/cp/parser.c:16996
0x696b65 cp_parser_simple_declaration
../../gcc/cp/parser.c:11406
0x67a6a3 cp_parser_block_declaration
../../gcc/cp/parser.c:11287
0x67b821 cp_parser_declaration_statement
../../gcc/cp/parser.c:10934
0x67bf0b cp_parser_statement
../../gcc/cp/parser.c:9649
0x67cd39 cp_parser_statement_seq_opt
../../gcc/cp/parser.c:9927
0x67cea6 cp_parser_compound_statement
../../gcc/cp/parser.c:9881
0x68e11b cp_parser_function_body
../../gcc/cp/parser.c:18952
0x68e11b cp_parser_ctor_initializer_opt_and_function_body
../../gcc/cp/parser.c:18988
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.