push_deferring_access_checks (dk_no_deferred);
input_location = DECL_SOURCE_LOCATION (fn);
- if (!DECL_LOCAL_DECL_P (fn))
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+ && !DECL_LOCAL_DECL_P (fn))
{
/* If needed, set current_class_ptr for the benefit of
- tsubst_copy/PARM_DECL. The exception pattern will
- refer to the parm of the template, not the
- instantiation. */
- tree tdecl = DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (fn));
- if (DECL_NONSTATIC_MEMBER_FUNCTION_P (tdecl))
- {
- tree this_parm = DECL_ARGUMENTS (tdecl);
- current_class_ptr = NULL_TREE;
- current_class_ref = cp_build_fold_indirect_ref (this_parm);
- current_class_ptr = this_parm;
- }
+ tsubst_copy/PARM_DECL. */
+ tree this_parm = DECL_ARGUMENTS (fn);
+ current_class_ptr = NULL_TREE;
+ current_class_ref = cp_build_fold_indirect_ref (this_parm);
+ current_class_ptr = this_parm;
}
/* If this function is represented by a TEMPLATE_DECL, then
{
constexpr int f () { return 0; }
bool b = true;
- void g () noexcept (f()) { } // { dg-error "use of parameter" }
- void g2 () noexcept (this->f()) { } // { dg-error "use of parameter" }
+ void g () noexcept (f()) { } // { dg-error ".this. is not a constant" }
+ void g2 () noexcept (this->f()) { } // { dg-error ".this. is not a constant" }
void g3 () noexcept (b) { } // { dg-error "use of .this. in a constant expression|use of parameter" }
void g4 (int i) noexcept (i) { } // { dg-error "use of parameter" }
- void g5 () noexcept (A::f()) { } // { dg-error "use of parameter" }
+ void g5 () noexcept (A::f()) { } // { dg-error ".this. is not a constant" }
void g6 () noexcept (foo(b)) { } // { dg-error "use of .this. in a constant expression|use of parameter" }
- void g7 () noexcept (int{f()}) { } // { dg-error "use of parameter" }
+ void g7 () noexcept (int{f()}) { } // { dg-error ".this. is not a constant" }
};
int main ()