Attached is the patch to avoid the ICE that Kai posted below with the test case Marek asked for in his response. I didn't see any further followup on the list.
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02325.html Martin
gcc/testsuite/ChangeLog: 2016-01-19 Martin Sebor <mse...@redhat.com> PR c++/59759 * gcc/testsuite/g++.dg/template/pr59759.C: New test. gcc/cp/ChangeLog: 2015-05-26 Kai Tietz <ktiet...@googlemail.com> PR c++/69277 * pt.c (unify): Don't ICE on VAR_DECL. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 6062ebe..3361796 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -19928,11 +19928,11 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, return unify_template_argument_mismatch (explain_p, parm, arg); case VAR_DECL: - /* A non-type template parameter that is a variable should be a + /* A non-type template parameter that is a variable should be an integral constant, in which case, it whould have been - folded into its (constant) value. So we should not be getting - a variable here. */ - gcc_unreachable (); + folded into its (constant) value. So we should not see + a variable here except for ill-formed programs. */ + return unify_template_argument_mismatch (explain_p, parm, arg); case TYPE_ARGUMENT_PACK: case NONTYPE_ARGUMENT_PACK: diff --git a/gcc/testsuite/g++.dg/template/pr59759.C b/gcc/testsuite/g++.dg/template/pr59759.C new file mode 100644 index 0000000..c6a0b04 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr59759.C @@ -0,0 +1,23 @@ +// PR c++/59759 - internal compiler error: in unify, using std::enable_if +// on classes +// { dg-do compile } + +template <class T> +struct B { }; + +template <class, class T> +struct C { + typedef T U; +}; + +const int x = 0; + +// The default argument below is invalid for A<int>. +template <class T, class C<B<T>, int>::U = x> +struct A; + +template <class T> +void f (A<T>*) { + A<int>* map; // { dg-error "not a class type" } + f (map); // { dg-error "no matching function" } +}