https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96179
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |10.2 CC| |mpolacek at gcc dot gnu.org Summary|g++-10.1 silently doesn't |[10/11 Regression] g++-10.1 |push_back the return of a |silently doesn't push_back |void function |the return of a void | |function Ever confirmed|0 |1 Known to work| |9.3.1 Keywords| |accepts-invalid Known to fail| |10.1.1, 11.0 Last reconfirmed| |2020-07-13 Status|UNCONFIRMED |NEW --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Confirmed. This started with r10-7096 (like PR 95789). A reduced example shows that GCC even warns the vector variable is unused: template<typename T> struct vector { void push_back(T) { } }; struct dummy{ int a; }; void Modify_Dummy(dummy &d){ d.a=1; } template <bool bla=true> void Templated_Function(){ vector<dummy> A; A.push_back(Modify_Dummy(dummy{0})); } int main(){ Templated_Function(); } 96179.C: In instantiation of 'void Templated_Function() [with bool bla = true]': 96179.C:20:28: required from here 96179.C:15:23: warning: variable 'A' set but not used [-Wunused-but-set-variable] 15 | vector<dummy> A; | ^