https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96179

            Bug ID: 96179
           Summary: g++-10.1 silently doesn't push_back the return of a
                    void function
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: agadethrowaway at gmail dot com
  Target Milestone: ---

Created attachment 48866
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48866&action=edit
Minimal reproducing example

#include <vector>
using namespace std;

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();
}

Compiled with

all:
        g++-10 Void_Pushback.cpp -o Void_Pushback

using:

g++-10 (Ubuntu 10-20200411-0ubuntu1) 10.0.1 20200411 (experimental) [master
revision bb87d5cc77d:75961caccb7:f883c46b4877f637e0fa5025b4d6b5c9040ec566]

Copy of code attached.

Code should not compile. The push_back instruction is silently ignored and the
vector stays empty.

Reply via email to