This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/65591] New: G++ should use default constructor for {}-init when possible


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]