public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58599] New: [c++11] Trouble with non-static data member initializers in templates
@ 2013-10-02 20:51 reichelt at gcc dot gnu.org
2013-10-03 10:21 ` [Bug c++/58599] " mpolacek at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-02 20:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58599
Bug ID: 58599
Summary: [c++11] Trouble with non-static data member
initializers in templates
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
The following code snippets (compiled with "-std=c++11") trigger ICEs various
places since GCC 4.7.0 (when non-static data member initializers were
introduced):
=============================================
template<int> struct A;
template<> struct A<0>
{
template<typename, typename...> struct B
{
template<typename> int foo() {}
int i = foo<int>();
};
};
=============================================
bug.cc: In substitution of 'template<class, class ...> template<class> int
A<0>::B< <template-parameter-1-1>, <template-parameter-1-2> >::foo() [with
<template-parameter-2-1> = <missing>; <template-parameter-1-1> = int;
<template-parameter-1-2> = <missing>]':
bug.cc:9:22: required from here
bug.cc:7:28: internal compiler error: tree check: accessed elt 2 of tree_vec
with 1 elts in tsubst_pack_expansion, at cp/pt.c:9535
template<typename> int foo() {}
^
0xce33c5 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
../../gcc/gcc/tree.c:9361
0x5aa862 tree_vec_elt_check
../../gcc/gcc/tree.h:2799
0x5aa862 tsubst_pack_expansion
../../gcc/gcc/cp/pt.c:9535
0x5b89a2 tsubst_template_args
../../gcc/gcc/cp/pt.c:9738
0x5b87dc tsubst_template_args
../../gcc/gcc/cp/pt.c:9756
0x5b910e tsubst_aggr_type
../../gcc/gcc/cp/pt.c:9971
0x5acb1d tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11364
0x5ac217 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11354
0x5b6fa6 tsubst_arg_types
../../gcc/gcc/cp/pt.c:11012
0x5b73ce tsubst_function_type
../../gcc/gcc/cp/pt.c:11111
0x5aca1c tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11822
0x5d21d5 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
../../gcc/gcc/cp/pt.c:15361
0x53f0fc add_template_candidate_real
../../gcc/gcc/cp/call.c:2923
0x53ae69 add_template_candidate
../../gcc/gcc/cp/call.c:3020
0x53ae69 add_candidates
../../gcc/gcc/cp/call.c:5075
0x542536 build_new_method_call_1
../../gcc/gcc/cp/call.c:7697
0x542536 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
../../gcc/gcc/cp/call.c:7883
0x6427ad cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:5980
0x64483d cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:7009
0x64540f cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:7701
Please submit a full bug report, [etc.]
=============================================
template<int> struct A;
template<> struct A<0>
{
template<typename, typename> struct B
{
template<typename> int foo() {}
int i = foo<int>();
};
};
=============================================
bug.cc: In substitution of 'template<class, class> template<class> int A<0>::B<
<template-parameter-1-1>, <template-parameter-1-2> >::foo() [with
<template-parameter-2-1> = <missing>; <template-parameter-1-1> = int;
<template-parameter-1-2> = <missing>]':
bug.cc:9:22: required from here
bug.cc:7:28: internal compiler error: tree check: accessed elt 2 of tree_vec
with 1 elts in tsubst, at cp/pt.c:11429
template<typename> int foo() {}
^
0xce33c5 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
../../gcc/gcc/tree.c:9361
0x5aea72 tree_vec_elt_check
../../gcc/gcc/tree.h:2799
0x5aea72 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11429
0x5b86fa tsubst_template_args
../../gcc/gcc/cp/pt.c:9774
0x5b910e tsubst_aggr_type
../../gcc/gcc/cp/pt.c:9971
0x5acb1d tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11364
0x5ac217 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11354
0x5b6fa6 tsubst_arg_types
../../gcc/gcc/cp/pt.c:11012
0x5b73ce tsubst_function_type
../../gcc/gcc/cp/pt.c:11111
0x5aca1c tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11822
0x5d21d5 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
../../gcc/gcc/cp/pt.c:15361
0x53f0fc add_template_candidate_real
../../gcc/gcc/cp/call.c:2923
0x53ae69 add_template_candidate
../../gcc/gcc/cp/call.c:3020
0x53ae69 add_candidates
../../gcc/gcc/cp/call.c:5075
0x542536 build_new_method_call_1
../../gcc/gcc/cp/call.c:7697
0x542536 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
../../gcc/gcc/cp/call.c:7883
0x6427ad cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:5980
0x64483d cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:7009
0x64540f cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:7701
0x6458cf cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:7937
Please submit a full bug report, [etc.]
=============================================
template<int> struct A;
template<> struct A<0>
{
template<typename> struct B
{
template<typename> int foo() {}
int i = foo<int>();
};
};
=============================================
bug.cc: In substitution of 'template<class> template<class> int A<0>::B<
<template-parameter-1-1> >::foo() [with <template-parameter-2-1> = <missing>;
<template-parameter-1-1> = int]':
bug.cc:9:22: required from here
bug.cc:9:22: internal compiler error: in retrieve_specialization, at
cp/pt.c:1030
int i = foo<int>();
^
0x593b50 retrieve_specialization
../../gcc/gcc/cp/pt.c:1027
0x5d0ba0 instantiate_template_1
../../gcc/gcc/cp/pt.c:15023
0x5d0ba0 instantiate_template(tree_node*, tree_node*, int)
../../gcc/gcc/cp/pt.c:15117
0x5d264a fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
../../gcc/gcc/cp/pt.c:15466
0x53f0fc add_template_candidate_real
../../gcc/gcc/cp/call.c:2923
0x53ae69 add_template_candidate
../../gcc/gcc/cp/call.c:3020
0x53ae69 add_candidates
../../gcc/gcc/cp/call.c:5075
0x542536 build_new_method_call_1
../../gcc/gcc/cp/call.c:7697
0x542536 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
../../gcc/gcc/cp/call.c:7883
0x6427ad cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:5980
0x64483d cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:7009
0x64540f cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:7701
0x6458cf cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:7937
0x645d26 cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:7987
0x645d26 cp_parser_constant_expression
../../gcc/gcc/cp/parser.c:8197
0x6472f6 cp_parser_late_parse_one_default_arg
../../gcc/gcc/cp/parser.c:23056
0x6364f5 cp_parser_late_parsing_nsdmi
../../gcc/gcc/cp/parser.c:23110
0x6364f5 cp_parser_class_specifier_1
../../gcc/gcc/cp/parser.c:19068
0x638930 cp_parser_class_specifier
../../gcc/gcc/cp/parser.c:19101
0x638930 cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:14080
Please submit a full bug report, [etc.]
A last variant is wrongly rejected:
=============================================
template<int> struct A;
template<> struct A<0>
{
template<int> struct B
{
template<typename> int foo() {}
int i = foo<int>();
};
};
=============================================
bug.cc:9:22: error: no matching function for call to 'A<0>::B<<anonymous>
>::foo()'
int i = foo<int>();
^
bug.cc:9:22: note: candidate is:
bug.cc:7:28: note: template<int <anonymous> > template<class> int
A<0>::B<<anonymous> >::foo()
template<typename> int foo() {}
^
bug.cc:7:28: note: template argument deduction/substitution failed:
bug.cc: In substitution of 'template<int <anonymous> > template<class> int
A<0>::B<<anonymous> >::foo() [with <template-parameter-2-1> = <missing>; int
<anonymous> = int]':
bug.cc:9:22: required from here
bug.cc:7:28: error: type/value mismatch at argument 1 in template parameter
list for 'template<int <anonymous> > struct A<0>::B'
bug.cc:7:28: error: expected a constant of type 'int', got 'int'
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/58599] [c++11] Trouble with non-static data member initializers in templates
2013-10-02 20:51 [Bug c++/58599] New: [c++11] Trouble with non-static data member initializers in templates reichelt at gcc dot gnu.org
@ 2013-10-03 10:21 ` mpolacek at gcc dot gnu.org
2013-10-03 23:55 ` paolo.carlini at oracle dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-03 10:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58599
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-10-03
CC| |jason at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The first one started ICEing with r180707.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/58599] [c++11] Trouble with non-static data member initializers in templates
2013-10-02 20:51 [Bug c++/58599] New: [c++11] Trouble with non-static data member initializers in templates reichelt at gcc dot gnu.org
2013-10-03 10:21 ` [Bug c++/58599] " mpolacek at gcc dot gnu.org
@ 2013-10-03 23:55 ` paolo.carlini at oracle dot com
2013-10-04 7:57 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-03 23:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58599
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Marek, can you please double check the revision number? r180707 first blush
seems unlikely to have caused the problem.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/58599] [c++11] Trouble with non-static data member initializers in templates
2013-10-02 20:51 [Bug c++/58599] New: [c++11] Trouble with non-static data member initializers in templates reichelt at gcc dot gnu.org
2013-10-03 10:21 ` [Bug c++/58599] " mpolacek at gcc dot gnu.org
2013-10-03 23:55 ` paolo.carlini at oracle dot com
@ 2013-10-04 7:57 ` mpolacek at gcc dot gnu.org
2013-11-15 20:32 ` reichelt at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-04 7:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58599
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Gah, sorry, you're right. In fact, started with r179156:
$ ./cc1plus-179156 -quiet -std=c++0x ~/x.C
/home/polacek/x.C: In substitution of ‘template<class, class ...>
template<class> int A<0>::B::foo() [with <template-parameter-2-1> = <missing>,
<template-parameter-1-1> = int, <template-parameter-1-2> = <missing>]’:
/home/polacek/x.C:9:22: required from here
/home/polacek/x.C:7:28: internal compiler error: tree check: accessed elt 2 of
tree_vec with 1 elts in tsubst_pack_expansion, at cp/pt.c:9153
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
>From gcc-bugs-return-431064-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Oct 04 08:08:24 2013
Return-Path: <gcc-bugs-return-431064-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 19180 invoked by alias); 4 Oct 2013 08:08:23 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 19132 invoked by uid 48); 4 Oct 2013 08:08:19 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58597] [c++11] ICE with lambda in default argument of template function
Date: Fri, 04 Oct 2013 08:08:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-58597-4-zwez35vVcG@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58597-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58597-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg00208.txt.bz2
Content-length: 221
http://gcc.gnu.org/bugzilla/show_bug.cgi?idX597
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yeah, indeed :(. As it's too old, I don't have enough cc1plus binaries to
really bisect it. Sorry.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/58599] [c++11] Trouble with non-static data member initializers in templates
2013-10-02 20:51 [Bug c++/58599] New: [c++11] Trouble with non-static data member initializers in templates reichelt at gcc dot gnu.org
` (2 preceding siblings ...)
2013-10-04 7:57 ` mpolacek at gcc dot gnu.org
@ 2013-11-15 20:32 ` reichelt at gcc dot gnu.org
2013-11-15 20:36 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-11-15 20:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58599
Volker Reichelt <reichelt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |paolo.carlini at oracle dot com
--- Comment #4 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Paolo, this bug was fixed on trunk by your patch for PR57887.
Do you want to add (some of) these testcases to the testsuite?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/58599] [c++11] Trouble with non-static data member initializers in templates
2013-10-02 20:51 [Bug c++/58599] New: [c++11] Trouble with non-static data member initializers in templates reichelt at gcc dot gnu.org
` (3 preceding siblings ...)
2013-11-15 20:32 ` reichelt at gcc dot gnu.org
@ 2013-11-15 20:36 ` paolo.carlini at oracle dot com
2013-11-15 23:17 ` paolo at gcc dot gnu.org
2013-11-15 23:19 ` paolo.carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-15 20:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58599
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Oh, nice. Yes will do.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/58599] [c++11] Trouble with non-static data member initializers in templates
2013-10-02 20:51 [Bug c++/58599] New: [c++11] Trouble with non-static data member initializers in templates reichelt at gcc dot gnu.org
` (4 preceding siblings ...)
2013-11-15 20:36 ` paolo.carlini at oracle dot com
@ 2013-11-15 23:17 ` paolo at gcc dot gnu.org
2013-11-15 23:19 ` paolo.carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-11-15 23:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58599
--- Comment #6 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Nov 15 23:17:23 2013
New Revision: 204866
URL: http://gcc.gnu.org/viewcvs?rev=204866&root=gcc&view=rev
Log:
2013-11-15 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58599
* g++.dg/cpp0x/nsdmi-template5.C: New.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/58599] [c++11] Trouble with non-static data member initializers in templates
2013-10-02 20:51 [Bug c++/58599] New: [c++11] Trouble with non-static data member initializers in templates reichelt at gcc dot gnu.org
` (5 preceding siblings ...)
2013-11-15 23:17 ` paolo at gcc dot gnu.org
@ 2013-11-15 23:19 ` paolo.carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-15 23:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58599
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC|paolo.carlini at oracle dot com |
Resolution|--- |FIXED
Target Milestone|--- |4.9.0
--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-11-15 23:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-02 20:51 [Bug c++/58599] New: [c++11] Trouble with non-static data member initializers in templates reichelt at gcc dot gnu.org
2013-10-03 10:21 ` [Bug c++/58599] " mpolacek at gcc dot gnu.org
2013-10-03 23:55 ` paolo.carlini at oracle dot com
2013-10-04 7:57 ` mpolacek at gcc dot gnu.org
2013-11-15 20:32 ` reichelt at gcc dot gnu.org
2013-11-15 20:36 ` paolo.carlini at oracle dot com
2013-11-15 23:17 ` paolo at gcc dot gnu.org
2013-11-15 23:19 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).