re PR c++/56947 (Bogus 'XX' was not declared in this scope)

PR c++/56947
	* pt.c (instantiate_decl): Don't defer instantiation of a nested
	function.

From-SVN: r211083
This commit is contained in:
Jason Merrill 2014-05-30 11:09:29 -04:00 committed by Jason Merrill
parent fa4ae80ed6
commit 8f71696861
3 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2014-05-30 Jason Merrill <jason@redhat.com>
PR c++/56947
* pt.c (instantiate_decl): Don't defer instantiation of a nested
function.
2014-05-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline

View File

@ -18191,6 +18191,7 @@ instantiate_decl (tree d, int defer_ok,
if the variable has a constant value the referring expression can
take advantage of that fact. */
if (TREE_CODE (d) == VAR_DECL
|| decl_function_context (d)
|| DECL_DECLARED_CONSTEXPR_P (d))
defer_ok = 0;

View File

@ -0,0 +1,18 @@
// PR c++/56947
struct A
{
A (int);
};
template < typename >
void Fn ()
{
const int kCapacity = 0;
struct Q:A
{
Q ():A (kCapacity) { }
};
Q q;
}
template void Fn < int >();