In [dcl.attr.depend]/1, I read:
The attribute[...]
carries_dependency
[...] may be applied to thedeclarator-id
of aparameter-declaration
in a function declaration or lambda, in which case it specifies that the initialization of the parameter carries a dependency to (1.10) each lvalue-to-rvalue conversion (4.1) of that object. The attribute may also be applied to thedeclarator-id
of a function declaration, in which case it specifies that the return value, if any, carries a dependency to the evaluation of the function call expression.
What I'm missing is a way to apply the attribute to the implicit this
parameter.
By way of example, consider this free function:
void fun(int i, Foo * [[carries_dependency]] f);
and it's equivalent (but for the attribute) member version:
void Foo::fun(int i); // can't add [[carries_dependency]] here?
[[carries_dependency]] void fun( int );
orvoid fun(int) [[carries_dependency]];
in the declaration. – Archfiend