Commit 35d87f01 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/87934 (struct with NSDMI of enum makes initialization a non-constant expression)

	PR c++/87934
	* constexpr.c (cxx_eval_constant_expression) <case CONSTRUCTOR>: Do
	re-process TREE_CONSTANT CONSTRUCTORs if they aren't reduced constant
	expressions.

	* g++.dg/cpp0x/constexpr-87934.C: New test.

From-SVN: r267253
parent 0d3d674b
2018-12-19 Jakub Jelinek <jakub@redhat.com>
PR c++/87934
* constexpr.c (cxx_eval_constant_expression) <case CONSTRUCTOR>: Do
re-process TREE_CONSTANT CONSTRUCTORs if they aren't reduced constant
expressions.
2018-12-19 Alexandre Oliva <aoliva@redhat.com>
PR c++/87012
......
......@@ -4681,7 +4681,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
break;
case CONSTRUCTOR:
if (TREE_CONSTANT (t))
if (TREE_CONSTANT (t) && reduced_constant_expression_p (t))
{
/* Don't re-process a constant CONSTRUCTOR, but do fold it to
VECTOR_CST if applicable. */
......
2018-12-19 Jakub Jelinek <jakub@redhat.com>
PR c++/87934
* g++.dg/cpp0x/constexpr-87934.C: New test.
2018-12-19 Alexandre Oliva <aoliva@redhat.com>
PR testsuite/86153
......
// PR c++/87934
// { dg-do compile { target c++11 } }
struct Foo
{
enum { BAR } bar = BAR;
};
constexpr Foo foo{};
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