[Bug c++/96179] [10/11 Regression] g++-10.1 silently doesn't push_back the return of a void function

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 13 09:08:55 GMT 2020


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){

template <bool bla=true> void Templated_Function(){
        vector<dummy> A;

int main(){

96179.C: In instantiation of 'void Templated_Function() [with bool bla =
96179.C:20:28:   required from here
96179.C:15:23: warning: variable 'A' set but not used
   15 |         vector<dummy> A;
      |                       ^

More information about the Gcc-bugs mailing list