PR c++/89512
* semantics.c (finish_qualified_id_expr): Reject variable templates.
* g++.dg/cpp1y/var-templ61.C: New test.
From-SVN: r269672
2019-03-14 Jakub Jelinek <jakub@redhat.com>
+ PR c++/89512
+ * semantics.c (finish_qualified_id_expr): Reject variable templates.
+
PR c++/89652
* constexpr.c (struct constexpr_ctx): Change save_exprs type from
hash_set<tree> to vec<tree>.
expr = build_offset_ref (qualifying_class, expr, /*address_p=*/false,
complain);
}
+ else if (!template_p
+ && TREE_CODE (expr) == TEMPLATE_DECL
+ && !DECL_FUNCTION_TEMPLATE_P (expr))
+ {
+ if (complain & tf_error)
+ error ("%qE missing template arguments", expr);
+ return error_mark_node;
+ }
else
{
/* In a template, return a SCOPE_REF for most qualified-ids
2019-03-14 Jakub Jelinek <jakub@redhat.com>
+ PR c++/89512
+ * g++.dg/cpp1y/var-templ61.C: New test.
+
PR c++/89652
* g++.dg/cpp1y/constexpr-89652.C: New test.
--- /dev/null
+// PR c++/89512
+// { dg-do compile { target c++14 } }
+
+struct A {
+ template <typename T>
+ static const int a = 0;
+};
+
+struct B {
+ template <typename T>
+ static int foo ()
+ {
+ return T::a; // { dg-error "missing template arguments" }
+ }
+};
+
+int bar ()
+{
+ return B::foo<A> (); // { dg-message "required from here" }
+}