Commit b6e45a40 by Jason Merrill Committed by Jason Merrill

PR c++/89682 - wrong access error in default argument.

Here we were pushing into the right access context, but we were called from
a deferred checking context, so didn't end up doing the checks until after
we left the access context.

	* pt.c (tsubst_default_argument): Don't defer access checks.

From-SVN: r269766
parent ca6d4a08
2019-03-18 Jason Merrill <jason@redhat.com>
PR c++/89682 - wrong access error in default argument.
* pt.c (tsubst_default_argument): Don't defer access checks.
2019-03-18 Paolo Carlini <paolo.carlini@oracle.com> 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/85014 PR c++/85014
......
...@@ -12776,6 +12776,7 @@ tsubst_default_argument (tree fn, int parmnum, tree type, tree arg, ...@@ -12776,6 +12776,7 @@ tsubst_default_argument (tree fn, int parmnum, tree type, tree arg,
rather than in the current class. */ rather than in the current class. */
push_to_top_level (); push_to_top_level ();
push_access_scope (fn); push_access_scope (fn);
push_deferring_access_checks (dk_no_deferred);
start_lambda_scope (parm); start_lambda_scope (parm);
/* The default argument expression may cause implicitly defined /* The default argument expression may cause implicitly defined
...@@ -12799,6 +12800,7 @@ tsubst_default_argument (tree fn, int parmnum, tree type, tree arg, ...@@ -12799,6 +12800,7 @@ tsubst_default_argument (tree fn, int parmnum, tree type, tree arg,
inform (input_location, inform (input_location,
" when instantiating default argument for call to %qD", fn); " when instantiating default argument for call to %qD", fn);
pop_deferring_access_checks ();
pop_access_scope (fn); pop_access_scope (fn);
pop_from_top_level (); pop_from_top_level ();
......
// PR c++/89682
template <typename T>
class C {
class TagType {};
public:
C(int, TagType = makeTag());
private:
static TagType makeTag();
};
void test() {
C<int>(1);
}
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