https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36587
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Target Milestone|--- |7.0 Status|UNCONFIRMED |RESOLVED --- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> --- C++17 adds nodiscard attribute which can be placed on class/struct types, functions, constructors and others and then you get a warning if you ignore the value. In the case of struct/class types and constructors that will warn when a temporary value is ignored. Exactly in the case you were asking for a warning. Which was added to GCC by r7-377-gb632761d2c6a65 (and fixes afterwards). So closing as fixed.