mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/65195 (Variable template cannot be used as a function)
PR c++/65195 PR c++/66619 * semantics.c (finish_id_expression): Call convert_from_reference for variable template. From-SVN: r226641
This commit is contained in:
parent
76787f7009
commit
85171e7877
|
|
@ -1,3 +1,10 @@
|
||||||
|
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>
|
2015-08-04 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
* pt.c (lookup_template_class_1): Clear elt.spec.
|
* pt.c (lookup_template_class_1): Clear elt.spec.
|
||||||
|
|
|
||||||
|
|
@ -3564,6 +3564,7 @@ finish_id_expression (tree id_expression,
|
||||||
{
|
{
|
||||||
decl = finish_template_variable (decl);
|
decl = finish_template_variable (decl);
|
||||||
mark_used (decl);
|
mark_used (decl);
|
||||||
|
decl = convert_from_reference (decl);
|
||||||
}
|
}
|
||||||
else if (scope)
|
else if (scope)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
// 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>();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
// 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&&>;
|
||||||
Loading…
Reference in New Issue