diff options
author | Marek Polacek <polacek@redhat.com> | 2019-02-13 21:39:18 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2019-02-13 21:39:18 +0000 |
commit | f83fad402e6d6503a2322977837a9dba7edf68b8 (patch) | |
tree | 42dd02c9db5e600aa2db2dec5da99441301d5846 | |
parent | 10839133ce6c196c9f338086ede5b3b192fc1944 (diff) | |
download | gcc-f83fad402e6d6503a2322977837a9dba7edf68b8.zip gcc-f83fad402e6d6503a2322977837a9dba7edf68b8.tar.gz gcc-f83fad402e6d6503a2322977837a9dba7edf68b8.tar.bz2 |
PR c++/89297 - ICE with OVERLOAD in template.
* semantics.c (finish_compound_literal): Call
instantiate_non_dependent_expr_sfinae.
* g++.dg/cpp0x/initlist113.C: New test.
From-SVN: r268854
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist113.C | 11 |
4 files changed, 29 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ef51d9a..d6d1f59 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-02-13 Marek Polacek <polacek@redhat.com> + + PR c++/89297 - ICE with OVERLOAD in template. + * semantics.c (finish_compound_literal): Call + instantiate_non_dependent_expr_sfinae. + 2019-02-13 Alexandre Oliva <aoliva@redhat.com> PR c++/86379 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 89ea438..aa5a163 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2827,9 +2827,13 @@ finish_compound_literal (tree type, tree compound_literal, return error_mark_node; compound_literal = reshape_init (type, compound_literal, complain); if (SCALAR_TYPE_P (type) - && !BRACE_ENCLOSED_INITIALIZER_P (compound_literal) - && !check_narrowing (type, compound_literal, complain)) - return error_mark_node; + && !BRACE_ENCLOSED_INITIALIZER_P (compound_literal)) + { + tree t = instantiate_non_dependent_expr_sfinae (compound_literal, + complain); + if (!check_narrowing (type, t, complain)) + return error_mark_node; + } if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == NULL_TREE) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 74d0ad3..c4aef56 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-13 Marek Polacek <polacek@redhat.com> + + PR c++/89297 - ICE with OVERLOAD in template. + * g++.dg/cpp0x/initlist113.C: New test. + 2019-02-13 Alexandre Oliva <aoliva@redhat.com> PR c++/86379 diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist113.C b/gcc/testsuite/g++.dg/cpp0x/initlist113.C new file mode 100644 index 0000000..0b7e7ff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist113.C @@ -0,0 +1,11 @@ +// PR c++/89297 +// { dg-do compile { target c++11 } } + +int id(int v) { return v; } +float id(float v) { return v; } + +template <typename> +int foo(int v) +{ + return int{id(v)}; +} |