================
@@ -19,8 +19,10 @@ namespace usage_invalid {
namespace usage_ok {
struct IntRef { int *target; };
+ const int *defaultparam(const int &def1 [[clang::lifetimebound]] = 0); //
#def1
int &refparam(int ¶m [[clang::lifetimebound]]);
int &classparam(IntRef param [[clang::lifetimebound]]);
+ const int *c = defaultparam(); // expected-warning {{temporary whose address
is used as value of local variable 'c' will be destroyed at the end of the
full-expression}} expected-note@#def1 {{default argument declared here}}
----------------
zygoloid wrote:
This note doesn't seem very clear -- it's not obvious why you're pointing at a
default argument or what it has to do with the diagnostic. You could copy what
we do for `note_init_with_default_member_initializer` and add a note something
like "initializing parameter with default argument" (which is still not great,
but it's consistent and it at least shows why the default argument is relevant
to the error).
https://github.com/llvm/llvm-project/pull/112047
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits