Skip to content

Commit

Permalink
PR c++/79607 - ICE with T{} initializer
Browse files Browse the repository at this point in the history
	* decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245592 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
jason committed Feb 20, 2017
1 parent c462f4c commit 9722fa4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gcc/cp/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2017-02-19 Jason Merrill <jason@redhat.com>

PR c++/79607 - ICE with T{} initializer
* decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.

PR c++/79566 - elaborated-type-specifier in range for
* parser.c (cp_parser_simple_declaration): Fix check for type
definition.
Expand Down
3 changes: 3 additions & 0 deletions gcc/cp/decl.c
Original file line number Diff line number Diff line change
Expand Up @@ -6662,6 +6662,9 @@ type_dependent_init_p (tree init)
else if (TREE_CODE (init) == CONSTRUCTOR)
/* A brace-enclosed initializer, e.g.: int i = { 3 }; ? */
{
if (dependent_type_p (TREE_TYPE (init)))
return true;

vec<constructor_elt, va_gc> *elts;
size_t nelts;
size_t i;
Expand Down
9 changes: 9 additions & 0 deletions gcc/testsuite/g++.dg/template/init11.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// PR c++/79607
// { dg-do compile { target c++11 } }

template<typename T> struct A
{
static const int i = int{T{}};
};

A<int> a;

0 comments on commit 9722fa4

Please sign in to comment.