Commit b6bb8977 by Jason Merrill Committed by Jason Merrill

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
parent 51db86a8
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);
......
// 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 >();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment