https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95454
Kyrylo Bohdanenko <kyrylo.bohdanenko at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kyrylo.bohdanenko at gmail dot
com
--- Comment #2 from Kyrylo Bohdanenko <kyrylo.bohdanenko at gmail dot com> ---
Still relevant as of the current trunk.
A workaround would be to declare the constructor(s) [[nodiscard]]:
struct Data {
[[nodiscard]] Data() {}
};
int main() {
Data{};
}
This actually issues a warning:
<source>: In function 'int main()':
<source>:6:11: warning: ignoring return value of 'Data::Data()', declared with
attribute 'nodiscard' [-Wunused-result]
Sandbox: https://godbolt.org/z/3Koj8rra7