This fixes a crash with -fconcepts on a few testcases.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit cee8cb05c77df3dd3c7d93dd70fb1061823f0e68
Author: Jason Merrill <[email protected]>
Date: Thu Mar 30 22:04:05 2017 -0400
* semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index c572646..0a69500 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3157,6 +3157,7 @@ finish_template_type (tree name, tree args, int
entering_scope)
if (flag_concepts
&& entering_scope
&& CLASS_TYPE_P (type)
+ && CLASSTYPE_TEMPLATE_INFO (type)
&& dependent_type_p (type)
&& PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (type)))
type = fixup_template_type (type);
diff --git a/gcc/testsuite/g++.dg/concepts/regress/alias-decl-42.C
b/gcc/testsuite/g++.dg/concepts/regress/alias-decl-42.C
new file mode 100644
index 0000000..611a896
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/regress/alias-decl-42.C
@@ -0,0 +1,18 @@
+// PR c++/59200
+// { dg-options "-std=c++1z -fconcepts" }
+
+struct A
+{
+ static constexpr bool value = true;
+};
+
+template<typename T>
+struct B
+{
+ template<typename U>
+ using C = A;
+};
+
+template<typename T>
+template<typename U>
+ const bool B<T>::C<U>::value; // { dg-error "too many" }