From: Jason Merrill Date: Fri, 16 Feb 2018 21:02:55 +0000 (-0500) Subject: PR c++/81853 - using-directive and constexpr. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3664e317b8efce5e4b37aca4724b05945bcbbb4f;p=gcc.git PR c++/81853 - using-directive and constexpr. * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT. From-SVN: r257762 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b7d45707d5e..07788c0d516 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2018-02-16 Jason Merrill + PR c++/81853 - using-directive and constexpr. + * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT. + PR c++/84420 - ICE with structured binding in lambda. * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index d89bdd5a6a4..91148aa8d72 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -4726,6 +4726,10 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, jump_target); break; + case USING_STMT: + r = void_node; + break; + default: if (STATEMENT_CODE_P (TREE_CODE (t))) { diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr22.C b/gcc/testsuite/g++.dg/ext/stmtexpr22.C new file mode 100644 index 00000000000..f46523a5875 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/stmtexpr22.C @@ -0,0 +1,13 @@ +// PR c++/81853 +// { dg-do compile { target c++11 } } +// { dg-options "" } + +namespace N { + enum { i }; +} + +int g () +{ + constexpr int j = ({ using namespace N; i; }); + return j; +}