Commit 04acc378 by Alexandre Oliva Committed by Alexandre Oliva

[PR c++/84968] reject stmt-exprs in noexcept constexprs

We reject extended statement-expressions in template parameters, so we
might as well reject them in constant expressions used in noexcept
specifications.

for  gcc/cp/ChangeLog

	PR c++/84968
	* tree.c (strip_typedefs_expr): Reject STATEMENT_LISTs.

for  gcc/testsuite/ChangeLog

	PR c++/84968
	* g++.dg/eh/pr84968.C: New.

From-SVN: r258913
parent d80bb039
2018-03-28 Alexandre Oliva <aoliva@redhat.com>
PR c++/84968
* tree.c (strip_typedefs_expr): Reject STATEMENT_LISTs.
2018-03-27 Paolo Carlini <paolo.carlini@oracle.com> 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/85067 PR c++/85067
......
...@@ -1788,6 +1788,10 @@ strip_typedefs_expr (tree t, bool *remove_attributes) ...@@ -1788,6 +1788,10 @@ strip_typedefs_expr (tree t, bool *remove_attributes)
error ("lambda-expression in a constant expression"); error ("lambda-expression in a constant expression");
return error_mark_node; return error_mark_node;
case STATEMENT_LIST:
error ("statement-expression in a constant expression");
return error_mark_node;
default: default:
break; break;
} }
......
2018-03-28 Alexandre Oliva <aoliva@redhat.com>
PR c++/84968
* g++.dg/eh/pr84968.C: New.
2018-03-27 Michael Meissner <meissner@linux.vnet.ibm.com> 2018-03-27 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/84914 PR target/84914
......
// { dg-do compile { target c++11 } }
// { dg-options "" }
union b;
struct S {
template <typename>
void a()
try {
} catch (int ()
noexcept (({ union b a; true; }))) // { dg-error "constant" }
{
}
};
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