From: Jason Merrill Date: Tue, 13 Jan 2015 14:49:04 +0000 (-0500) Subject: re PR c++/64297 (ICE: canonical types differ for identical types) X-Git-Tag: releases/gcc-4.8.5~331 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3303964efc0c997a7e8e91417fbf2f506540b497;p=thirdparty%2Fgcc.git 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: r219534 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bf6adf2e3560..090233abba03 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-01-13 Jason Merrill + + PR c++/64297 + * typeck.c (apply_memfn_quals): Correct wrong TYPE_CANONICAL. + 2014-12-19 Release Manager * GCC 4.8.4 released. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 2fa47025b7de..6da2f3b197d3 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -8639,6 +8639,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 000000000000..1d7650bb61ba --- /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 X m_fn1() const; +}; +template struct is_function {}; +is_function i; +struct D { + template > D(Y); +} b(&A::m_fn1<0>);