From: Jason Merrill Date: Thu, 26 Apr 2018 20:32:32 +0000 (-0400) Subject: PR c++/85545 - ICE with noexcept PMF conversion. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=128d29a52fcd9097c1e809c675dadd108f8dd604;p=gcc.git PR c++/85545 - ICE with noexcept PMF conversion. * cvt.c (cp_fold_convert): Handle PMF CONSTRUCTORs directly. From-SVN: r259689 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 037870627f9..491853e8166 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-04-26 Jason Merrill + + PR c++/85545 - ICE with noexcept PMF conversion. + * cvt.c (cp_fold_convert): Handle PMF CONSTRUCTORs directly. + 2018-04-25 Nathan Sidwell PR c++/85437 diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 9b53fa3067d..a3735a1cffe 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -601,7 +601,9 @@ cp_fold_convert (tree type, tree expr) tree conv; if (TREE_TYPE (expr) == type) conv = expr; - else if (TREE_CODE (expr) == PTRMEM_CST) + else if (TREE_CODE (expr) == PTRMEM_CST + || (TREE_CODE (expr) == CONSTRUCTOR + && TYPE_PTRMEMFUNC_P (type))) { /* Avoid wrapping a PTRMEM_CST in NOP_EXPR. */ conv = copy_node (expr); diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type20.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type20.C new file mode 100644 index 00000000000..a6033f71a4f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type20.C @@ -0,0 +1,14 @@ +// PR c++/85545 +// { dg-do compile { target c++11 } } + +struct A +{ + void foo() noexcept; +}; + +template void bar(T); + +void baz() +{ + bar(static_cast(&A::foo)); +}