diff options
author | Marek Polacek <polacek@redhat.com> | 2019-02-22 19:24:37 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2019-02-22 19:24:37 +0000 |
commit | 4770beb36c35cc8cf6be0bf061f987fb9429fa9a (patch) | |
tree | 847b766bd496cefd3030185c4117303caa676190 /gcc | |
parent | fcb141ac220aabc330dff94cb343a9a39da810c3 (diff) | |
download | gcc-4770beb36c35cc8cf6be0bf061f987fb9429fa9a.zip gcc-4770beb36c35cc8cf6be0bf061f987fb9429fa9a.tar.gz gcc-4770beb36c35cc8cf6be0bf061f987fb9429fa9a.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/cp/decl.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/explicit14.C | 11 |
4 files changed, 31 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0858646..8381391 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2019-02-22 Marek Polacek <polacek@redhat.com> + + 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 <thomas@codesourcery.com> * parser.c (cp_parser_oacc_simple_clause): Remove parser formal diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 612afba..c5b5bd3c 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 555dc4a..9fae9ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-22 Marek Polacek <polacek@redhat.com> + + PR c++/89420 - ICE with CAST_EXPR in explicit-specifier. + * g++.dg/cpp2a/explicit14.C: New test. + 2019-02-22 Matthew Malcomson <matthew.malcomson@arm.com> 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 0000000..9c3acc3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/explicit14.C @@ -0,0 +1,11 @@ +// PR c++/89420 +// { dg-do compile { target c++2a } } + +template<typename> +struct S { + explicit(int(1)) S(int); + explicit(int{1}) S(int, int); +}; + +S<int> s(1); +S<int> s2(1, 2); |