On 12/22/18 4:38 PM, Marek Polacek wrote:
I noticed that we weren't diagnosing using 'this' in noexcept-specifiers
of static member functions, and Jakub pointed out that this is also true
for trailing-return-type. cp_parser has local_variables_forbidden_p to
detect using local vars and 'this' in certain contexts, so let's use that.
...except that I found out that I need to be able to distinguish between
forbidding just local vars and/or this, so I've changed its type to char.
For instance, you can't use 'this' in a static member function declaration,
but you can use a local var because noexcept/decltype is an unevaluated
context.
I also noticed that we weren't diagnosing 'this' in a friend declaration,
which is also forbidden.
Bootstrapped/regtested on x86_64-linux, ok for trunk?
I wonder about suppressing inject_this_parm for a static member
function, since current_class_ptr is unset within a static member
function. But this approach (and patch) is also OK.
Jason