re PR c++/56947 (Bogus 'XX' was not declared in this scope)
PR c++/56947 * pt.c (instantiate_decl): Check that defer_ok is not set for local class members. From-SVN: r211094
This commit is contained in:
parent
51db86a829
commit
b6bb89777e
3 changed files with 27 additions and 0 deletions
|
@ -1,5 +1,9 @@
|
|||
2014-05-30 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/56947
|
||||
* pt.c (instantiate_decl): Check that defer_ok is not set for
|
||||
local class members.
|
||||
|
||||
PR c++/60992
|
||||
* pt.c (tsubst_init): Split out from...
|
||||
(tsubst_expr) [DECL_EXPR]: Here.
|
||||
|
|
|
@ -19696,6 +19696,11 @@ instantiate_decl (tree d, int defer_ok,
|
|||
if (external_p && !always_instantiate_p (d))
|
||||
return d;
|
||||
|
||||
/* Any local class members should be instantiated from the TAG_DEFN
|
||||
with defer_ok == 0. */
|
||||
gcc_checking_assert (!defer_ok || !decl_function_context (d)
|
||||
|| LAMBDA_TYPE_P (DECL_CONTEXT (d)));
|
||||
|
||||
gen_tmpl = most_general_template (tmpl);
|
||||
gen_args = DECL_TI_ARGS (d);
|
||||
|
||||
|
|
18
gcc/testsuite/g++.dg/template/local8.C
Normal file
18
gcc/testsuite/g++.dg/template/local8.C
Normal 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 >();
|
Loading…
Add table
Reference in a new issue