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

            Bug ID: 65591
           Summary: G++ should use default constructor for {}-init when
                    possible
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jason at gcc dot gnu.org
                CC: daniel.kruegler at googlemail dot com, jakub at gcc dot 
gnu.org,
                    jason at gcc dot gnu.org, maltsevm at gmail dot com,
                    mpolacek at gcc dot gnu.org, pinskia at gcc dot gnu.org
        Depends on: 65154

>From Mikhail Maltsev's comment 5 on Bug #65154:

But it reveals some latent bug (PR65503). In the following case (after applying
the patch):

struct ss {
    ss() {};
};
struct C {
      ss s[1000];
};
int main() {
      C cs[5]{};
}

We'll get 1000 calls to ss() in main instead of calling default c-tor of struct
C. (which is probably not what we want).

-----

I agree that we want to call the default constructor in this case, and let the
inliner decide from there.  This is not the same issue as bug 65503.

Reply via email to