aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-06-16 22:27:33 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-06-16 22:27:33 -0400
commitb126bff44d96201be452bf3d1b220c515bc0e26a (patch)
tree4252148907dce819df7c0209df8de31af84af1a5 /gcc
parentc0a73a40e9fdde782237a5114872434ee35d60d6 (diff)
downloadgcc-b126bff44d96201be452bf3d1b220c515bc0e26a.zip
gcc-b126bff44d96201be452bf3d1b220c515bc0e26a.tar.gz
gcc-b126bff44d96201be452bf3d1b220c515bc0e26a.tar.bz2
PR c++/80639 - ICE with invalid PMF initialization.
PR c++/80043 - ICE with -fpermissive * typeck.c (convert_for_assignment): Recurse when instantiate_type returns without an error. From-SVN: r249317
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/typeck.c5
-rw-r--r--gcc/testsuite/g++.dg/template/ptrmem31.C23
3 files changed, 33 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ce1e8d0..a2144c2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2017-06-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/80639 - ICE with invalid PMF initialization.
+ PR c++/80043 - ICE with -fpermissive
+ * typeck.c (convert_for_assignment): Recurse when instantiate_type
+ returns without an error.
+
2017-06-16 Nathan Sidwell <nathan@acm.org>
* pt.c (tsubst_baselink): Fix & clarify formatting.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 05b4fbb..0f22e64 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -8590,9 +8590,10 @@ convert_for_assignment (tree type, tree rhs,
if (rhstype == unknown_type_node)
{
tree r = instantiate_type (type, rhs, tf_warning_or_error);
- /* -fpermissive might allow this. */
+ /* -fpermissive might allow this; recurse. */
if (!seen_error ())
- return r;
+ return convert_for_assignment (type, r, errtype, fndecl,
+ parmnum, complain, flags);
}
else if (fndecl)
error ("cannot convert %qH to %qI for argument %qP to %qD",
diff --git a/gcc/testsuite/g++.dg/template/ptrmem31.C b/gcc/testsuite/g++.dg/template/ptrmem31.C
new file mode 100644
index 0000000..5c66b72
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ptrmem31.C
@@ -0,0 +1,23 @@
+// PR c++/80639
+// { dg-do compile { target c++14 } }
+
+template < typename > struct A;
+
+struct B
+{
+ template < int > void m ();
+ template < int > struct K { static void n (); };
+ void p () { K < 0 >::n (); }
+};
+
+template <> struct A < B >
+{
+ using T = void (A::*)();
+ template < int u > static constexpr T h = &B::m < u >; // { dg-error "cannot convert" }
+};
+
+template < int v > void B::K < v >::n ()
+{
+ using S = A < B >;
+ S::h < 0 >;
+}