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
+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>
PR c++/85014
rather than in the current class. */
push_to_top_level ();
push_access_scope (fn);
+ push_deferring_access_checks (dk_no_deferred);
start_lambda_scope (parm);
/* The default argument expression may cause implicitly defined
inform (input_location,
" when instantiating default argument for call to %qD", fn);
+ pop_deferring_access_checks ();
pop_access_scope (fn);
pop_from_top_level ();
--- /dev/null
+// PR c++/89682
+
+template <typename T>
+class C {
+ class TagType {};
+public:
+ C(int, TagType = makeTag());
+private:
+ static TagType makeTag();
+};
+
+void test() {
+ C<int>(1);
+}