else if (DECL_TYPE_TEMPLATE_P (olddecl)
|| DECL_TYPE_TEMPLATE_P (newdecl))
/* Class template conflicts. */;
+ else if ((TREE_CODE (olddecl) == TEMPLATE_DECL
+ && DECL_TEMPLATE_RESULT (olddecl)
+ && TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == VAR_DECL)
+ || (TREE_CODE (newdecl) == TEMPLATE_DECL
+ && DECL_TEMPLATE_RESULT (newdecl)
+ && TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == VAR_DECL))
+ /* Variable template conflicts. */;
+ else if (concept_definition_p (olddecl)
+ || concept_definition_p (newdecl))
+ /* Concept conflicts. */;
else if ((TREE_CODE (newdecl) == FUNCTION_DECL
&& DECL_FUNCTION_TEMPLATE_P (olddecl))
|| (TREE_CODE (olddecl) == FUNCTION_DECL
" literal operator template", newdecl);
else
return NULL_TREE;
-
+
inform (olddecl_loc, "previous declaration %q#D", olddecl);
return error_mark_node;
}
// { dg-do compile { target c++14 } }
-template <typename> struct bar foo; template <> struct foo<>: // { dg-error "class template" }
+template <typename> struct bar foo; template <> struct foo<>: // { dg-error "class template|redeclared" }
// { dg-error "-:expected" "" { target *-*-* } .+1 }
--- /dev/null
+// PR c++/94553
+// { dg-do compile { target c++14 } }
+
+struct C { };
+template<typename> int C; // { dg-error "different kind of entity" }
+template<typename> int D;
+struct D { }; // { dg-error "different kind of entity" }
--- /dev/null
+// PR c++/94553
+// { dg-do compile { target c++20 } }
+
+struct E { };
+template<typename> concept E = false; // { dg-error "different kind of entity" }
+template<typename> concept F = false;
+struct F { }; // { dg-error "different kind of entity" }