tree fns = get_fns (tid);
if (OVL_SINGLE_P (fns))
tmpl = OVL_FIRST (fns);
- error_at (token->location, "function template-id %qD "
- "in nested-name-specifier", tid);
+ if (function_concept_p (fns))
+ error_at (token->location, "concept-id %qD "
+ "in nested-name-specifier", tid);
+ else
+ error_at (token->location, "function template-id "
+ "%qD in nested-name-specifier", tid);
}
else
{
- /* Variable template. */
tmpl = TREE_OPERAND (tid, 0);
- gcc_assert (variable_template_p (tmpl));
- error_at (token->location, "variable template-id %qD "
- "in nested-name-specifier", tid);
+ if (variable_concept_p (tmpl)
+ || standard_concept_p (tmpl))
+ error_at (token->location, "concept-id %qD "
+ "in nested-name-specifier", tid);
+ else
+ {
+ /* Variable template. */
+ gcc_assert (variable_template_p (tmpl));
+ error_at (token->location, "variable template-id "
+ "%qD in nested-name-specifier", tid);
+ }
}
if (tmpl)
inform (DECL_SOURCE_LOCATION (tmpl),
--- /dev/null
+// { dg-do compile { target c++17 } }
+// { dg-options "-fconcepts" }
+
+template<typename T>
+concept foo = true; // { dg-message "declared here" }
+
+template<typename T>
+void bar(T t)
+{
+ if constexpr (foo<T>::value) // { dg-error "17:concept-id .foo<T>. in nested-name-specifier" }
+ // { dg-error "expected|value" "" { target c++17 } .-1 }
+ {
+ }
+}
+
+int main()
+{
+ bar(1);
+}
--- /dev/null
+// { dg-do compile { target c++17 } }
+// { dg-options "-fconcepts-ts" }
+
+template<typename T>
+concept bool foo() { return true; }; // { dg-message "declared here" }
+
+template<typename T>
+void bar(T t)
+{
+ if constexpr (foo<T>::value) // { dg-error "17:concept-id .foo<T>. in nested-name-specifier" }
+ // { dg-error "expected|value" "" { target *-*-* } .-1 }
+ {
+ }
+}
+
+int main()
+{
+ bar(1);
+}