re PR c++/70095 ([C++14] Link error on partially specialized variable template)

PR c++/70095
	* pt.c (instantiate_decl): Fix call to variable_template_p.

From-SVN: r234231
This commit is contained in:
Jason Merrill 2016-03-15 15:37:37 -04:00 committed by Jason Merrill
parent d4db81a273
commit d1ccf407da
3 changed files with 15 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2016-03-15 Jason Merrill <jason@redhat.com>
PR c++/70095
* pt.c (instantiate_decl): Fix call to variable_template_p.
PR c++/70141
* pt.c (for_each_template_parm_r): Always walk into TYPENAME_TYPE.

View File

@ -21935,7 +21935,7 @@ instantiate_decl (tree d, int defer_ok,
if (enter_context)
pop_nested_class ();
if (variable_template_p (td))
if (variable_template_p (gen_tmpl))
note_variable_template_instantiation (d);
}
else if (TREE_CODE (d) == FUNCTION_DECL && DECL_DEFAULTED_FN (code_pattern))

View File

@ -0,0 +1,11 @@
// PR c++/70095
// { dg-do link { target c++14 } }
template <typename T> struct Foo;
template <typename T> int variable_template = 0;
template <typename T> int variable_template<Foo<T>> = 0;
template <typename T> int get_variable_template() { return variable_template<T>; }
int main() {
get_variable_template<Foo<int>>();
}