I wanted to backport r232232 (aka 2edb91b1) which helps with the compile-time regression tracked by PR60976. On the gcc-4.9 branch it produces lots of ICEs due to PR61198, which was only fixed for gcc-5.
This backports the PR61198 fix to the 4.9 branch, which resolves the ICEs I'm seeing and so would let me also backport the libstdc++ change. Is this safe for 4.9? Tested powerpc64le-linux, no new failures.
commit d98a90afa73cecd8c62a93381cde2077471753f2 Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Feb 10 12:41:26 2016 +0000 Backport PR c++/61198 fix gcc: 2014-12-19 Kai Tietz <kti...@redhat.com> PR c++/61198 * pt.c (most_general_template): Don't break for template-alias. gcc/testsuite: 2014-12-19 Kai Tietz <kti...@redhat.com> Paolo Carlini <paolo.carl...@oracle.com> PR c++/61198 * g++.dg/cpp0x/alias-decl-45.C: New file. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 60e9671..7485b95 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18873,6 +18873,7 @@ most_general_template (tree decl) break; if (CLASS_TYPE_P (TREE_TYPE (decl)) + && !TYPE_DECL_ALIAS_P (TYPE_NAME (TREE_TYPE (decl))) && CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (decl))) break; diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-45.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-45.C new file mode 100644 index 0000000..e3434f5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-45.C @@ -0,0 +1,24 @@ +// PR c++/61198 +// { dg-do compile { target c++11 } } + +template<int herp, typename derp_t> +struct broken +{ + template<typename target_t> + using rebind = broken<herp, target_t>; +}; + +template<typename derp_t> +struct broken<2, derp_t> +{ + template<typename target_t> + using rebind = broken<2, target_t>; +}; + +int main(int argc, char **argv) +{ + broken<2, float>::rebind<double> u; + + return 0; +} +