From: Marek Polacek Date: Fri, 22 Feb 2019 19:24:37 +0000 (+0000) Subject: PR c++/89420 - ICE with CAST_EXPR in explicit-specifier. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4770beb36c35cc8cf6be0bf061f987fb9429fa9a;p=gcc.git PR c++/89420 - ICE with CAST_EXPR in explicit-specifier. * decl.c (build_explicit_specifier): Don't check processing_template_decl. Call instantiation_dependent_expression_p instead of value_dependent_expression_p. Call instantiate_non_dependent_expr_sfinae before build_converted_constant_expr instead of calling instantiate_non_dependent_expr after it. Add processing_template_decl_sentinel. * g++.dg/cpp2a/explicit14.C: New test. From-SVN: r269131 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0858646d19e..83813919609 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2019-02-22 Marek Polacek + + PR c++/89420 - ICE with CAST_EXPR in explicit-specifier. + * decl.c (build_explicit_specifier): Don't check + processing_template_decl. Call instantiation_dependent_expression_p + instead of value_dependent_expression_p. Call + instantiate_non_dependent_expr_sfinae before + build_converted_constant_expr instead of calling + instantiate_non_dependent_expr after it. Add + processing_template_decl_sentinel. + 2019-02-22 Thomas Schwinge * parser.c (cp_parser_oacc_simple_clause): Remove parser formal diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 612afbacd27..c5b5bd3ce08 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -16687,12 +16687,14 @@ require_deduced_type (tree decl, tsubst_flags_t complain) tree build_explicit_specifier (tree expr, tsubst_flags_t complain) { - if (processing_template_decl && value_dependent_expression_p (expr)) + if (instantiation_dependent_expression_p (expr)) /* Wait for instantiation, tsubst_function_decl will handle it. */ return expr; + expr = instantiate_non_dependent_expr_sfinae (expr, complain); + /* Don't let convert_like_real create more template codes. */ + processing_template_decl_sentinel s; expr = build_converted_constant_expr (boolean_type_node, expr, complain); - expr = instantiate_non_dependent_expr (expr); expr = cxx_constant_value (expr); return expr; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 555dc4aebfb..9fae9ffa169 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-22 Marek Polacek + + PR c++/89420 - ICE with CAST_EXPR in explicit-specifier. + * g++.dg/cpp2a/explicit14.C: New test. + 2019-02-22 Matthew Malcomson PR target/89324 diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit14.C b/gcc/testsuite/g++.dg/cpp2a/explicit14.C new file mode 100644 index 00000000000..9c3acc32ac4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/explicit14.C @@ -0,0 +1,11 @@ +// PR c++/89420 +// { dg-do compile { target c++2a } } + +template +struct S { + explicit(int(1)) S(int); + explicit(int{1}) S(int, int); +}; + +S s(1); +S s2(1, 2);