aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-12-15 15:19:51 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-12-15 15:19:51 -0500
commitb07891da2e13689940369c95145feae7c7f1ef47 (patch)
treef33260a7ccb7a432a194d5b0812d815cb7f717f9 /gcc
parent3202dcccb9dec6a008c9f1887fd4a4c75ebc8940 (diff)
downloadgcc-b07891da2e13689940369c95145feae7c7f1ef47.zip
gcc-b07891da2e13689940369c95145feae7c7f1ef47.tar.gz
gcc-b07891da2e13689940369c95145feae7c7f1ef47.tar.bz2
re PR c++/64297 (ICE: canonical types differ for identical types)
PR c++/64297 * typeck.c (apply_memfn_quals): Correct wrong TYPE_CANONICAL. From-SVN: r218763
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck.c6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/ref-qual16.C12
3 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c14020d..afb2483 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2014-12-15 Jason Merrill <jason@redhat.com>
+ PR c++/64297
+ * typeck.c (apply_memfn_quals): Correct wrong TYPE_CANONICAL.
+
N3778: Sized Deallocation
* call.c (non_placement_deallocation_fn_p): A global sized
operator delete is not a usual deallocation function until C++14.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 7b39816..9368b49 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -8945,6 +8945,12 @@ apply_memfn_quals (tree type, cp_cv_quals memfn_quals, cp_ref_qualifier rqual)
/* This should really have a different TYPE_MAIN_VARIANT, but that gets
complex. */
tree result = build_qualified_type (type, memfn_quals);
+ if (tree canon = TYPE_CANONICAL (result))
+ if (canon != result)
+ /* check_qualified_type doesn't check the ref-qualifier, so make sure
+ TYPE_CANONICAL is correct. */
+ TYPE_CANONICAL (result)
+ = build_ref_qualified_type (canon, type_memfn_rqual (result));
result = build_exception_variant (result, TYPE_RAISES_EXCEPTIONS (type));
return build_ref_qualified_type (result, rqual);
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C
new file mode 100644
index 0000000..1d7650b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C
@@ -0,0 +1,12 @@
+// PR c++/64297
+// { dg-do compile { target c++11 } }
+
+struct A {
+ typedef int X;
+ template <int> X m_fn1() const;
+};
+template <typename> struct is_function {};
+is_function<int() const &> i;
+struct D {
+ template <typename Y, typename = is_function<Y>> D(Y);
+} b(&A::m_fn1<0>);