PR c++/71630 - extern variable template

* pt.c (instantiate_decl): Fix pattern_defined for namespace scope
	variable templates.

From-SVN: r238622
This commit is contained in:
Jason Merrill 2016-07-21 23:45:43 -04:00 committed by Jason Merrill
parent a93f3513c2
commit 44ed47547a
3 changed files with 18 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2016-07-21 Jason Merrill <jason@redhat.com>
PR c++/71630
* pt.c (instantiate_decl): Fix pattern_defined for namespace scope
variable templates.
PR c++/71913
* call.c (unsafe_copy_elision_p): It's OK to elide when
initializing an unknown object.

View File

@ -21853,7 +21853,10 @@ instantiate_decl (tree d, int defer_ok,
else
{
deleted_p = false;
pattern_defined = ! DECL_IN_AGGR_P (code_pattern);
if (DECL_CLASS_SCOPE_P (code_pattern))
pattern_defined = ! DECL_IN_AGGR_P (code_pattern);
else
pattern_defined = ! DECL_EXTERNAL (code_pattern);
}
/* We may be in the middle of deferred access check. Disable it now. */

View File

@ -0,0 +1,10 @@
// PR c++/71630
// { dg-do compile { target c++14 } }
template <class T>
extern T pi;
int main()
{
return pi<int>;
}