re PR c++/89488 (ICE in merge_exception_specifiers, at cp/typeck2.c:2395)

/cp
2019-02-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/89488
	* method.c (process_subob_fn): When maybe_instantiate_noexcept
	returns false don't call merge_exception_specifiers.

/testsuite
2019-02-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/89488
	* g++.dg/cpp0x/nsdmi15.C: New.

/cp
2019-02-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/88987
	* parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
	for a non-constant parsed expression.

/testsuite
2019-02-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/88987
	* g++.dg/cpp0x/pr88987.C: New.

From-SVN: r269245
This commit is contained in:
Paolo Carlini 2019-02-27 10:02:23 +00:00 committed by Paolo Carlini
parent f86624d85f
commit 65b309f7a5
6 changed files with 57 additions and 4 deletions

View File

@ -1,3 +1,15 @@
2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/89488
* method.c (process_subob_fn): When maybe_instantiate_noexcept
returns false don't call merge_exception_specifiers.
2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/88987
* parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
for a non-constant parsed expression.
2019-02-26 Jakub Jelinek <jakub@redhat.com>
PR c++/89481

View File

@ -1256,9 +1256,13 @@ process_subob_fn (tree fn, tree *spec_p, bool *trivial_p,
if (spec_p)
{
maybe_instantiate_noexcept (fn);
tree raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
*spec_p = merge_exception_specifiers (*spec_p, raises);
if (!maybe_instantiate_noexcept (fn))
*spec_p = error_mark_node;
else
{
tree raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
*spec_p = merge_exception_specifiers (*spec_p, raises);
}
}
if (!trivial_fn_p (fn) && !dtor_from_ctor)

View File

@ -25143,7 +25143,17 @@ cp_parser_noexcept_specification_opt (cp_parser* parser,
parser->type_definition_forbidden_message
= G_("types may not be defined in an exception-specification");
expr = cp_parser_constant_expression (parser);
bool non_constant_p;
expr
= cp_parser_constant_expression (parser,
/*allow_non_constant=*/true,
&non_constant_p);
if (non_constant_p
&& !require_potential_rvalue_constant_expression (expr))
{
expr = NULL_TREE;
return_cond = true;
}
/* Restore the saved message. */
parser->type_definition_forbidden_message = saved_message;

View File

@ -1,3 +1,13 @@
2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/89488
* g++.dg/cpp0x/nsdmi15.C: New.
2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/88987
* g++.dg/cpp0x/pr88987.C: New.
2019-02-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/89280

View File

@ -0,0 +1,8 @@
// PR c++/89488
// { dg-do compile { target c++11 } }
struct zl {
struct {
int x2 = zl (); // { dg-error "default member" }
} fx;
};

View File

@ -0,0 +1,9 @@
// { dg-do compile { target c++11 } }
int sm;
template <typename T> T
pk () noexcept (sm) // { dg-error "constant expression" }
{
return 0;
}