Commit 8cb7aaa1 by Jason Merrill Committed by Jason Merrill

PR c++/79461 - ICE with lambda in constexpr constructor

	* constexpr.c (build_data_member_initialization): Ignore
	initialization of a local variable.

From-SVN: r245410
parent aa326bfb
2017-02-13 Jason Merrill <jason@redhat.com>
PR c++/79461 - ICE with lambda in constexpr constructor
* constexpr.c (build_data_member_initialization): Ignore
initialization of a local variable.
2017-02-13 Jakub Jelinek <jakub@redhat.com> 2017-02-13 Jakub Jelinek <jakub@redhat.com>
* init.c (warn_placement_new_too_small): Add missing space in * init.c (warn_placement_new_too_small): Add missing space in
......
...@@ -379,6 +379,9 @@ build_data_member_initialization (tree t, vec<constructor_elt, va_gc> **vec) ...@@ -379,6 +379,9 @@ build_data_member_initialization (tree t, vec<constructor_elt, va_gc> **vec)
if (TREE_CODE (member) == COMPONENT_REF) if (TREE_CODE (member) == COMPONENT_REF)
{ {
tree aggr = TREE_OPERAND (member, 0); tree aggr = TREE_OPERAND (member, 0);
if (TREE_CODE (aggr) == VAR_DECL)
/* Initializing a local variable, don't add anything. */
return true;
if (TREE_CODE (aggr) != COMPONENT_REF) if (TREE_CODE (aggr) != COMPONENT_REF)
/* Normal member initialization. */ /* Normal member initialization. */
member = TREE_OPERAND (member, 1); member = TREE_OPERAND (member, 1);
......
// PR c++/79461
// { dg-options -std=c++1z }
struct S {
constexpr S(int i) {
auto f = [i]{};
}
};
int main() {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment