PR c++/65195
PR c++/66619
* semantics.c (finish_id_expression): Call convert_from_reference
for variable template.
From-SVN: r226641
+2015-08-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/65195
+ PR c++/66619
+ * semantics.c (finish_id_expression): Call convert_from_reference
+ for variable template.
+
2015-08-04 Jason Merrill <jason@redhat.com>
* pt.c (lookup_template_class_1): Clear elt.spec.
{
decl = finish_template_variable (decl);
mark_used (decl);
+ decl = convert_from_reference (decl);
}
else if (scope)
{
--- /dev/null
+// PR c++/65195
+// { dg-do compile { target c++14 } }
+
+template<typename T>
+T constant {};
+
+template<typename T>
+struct foo {
+ int operator()() const
+ { return 3; }
+};
+
+template<typename T>
+auto& f = constant<foo<T>>;
+
+int main()
+{
+ // fine
+ auto& ref = f<int>; ref();
+
+ // error: f<int> cannot be used as a function
+ f<int>();
+}
--- /dev/null
+// PR c++/66619
+// { dg-do compile { target c++14 } }
+
+int y;
+template<class T> T val1 = y;
+auto&& x1 = val1<int&>;
+
+template<class T> T val2 = 0;
+auto&& x2 = val2<int&&>;