Bug 92058 - constinit disregards non-constexpr constructor
Summary: constinit disregards non-constexpr constructor
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: Marek Polacek
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2019-10-10 20:07 UTC by Marek Polacek
Modified: 2019-11-08 21:42 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-10-10 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2019-10-10 20:07:49 UTC
struct B {
    B() {}
};

struct A {
    constexpr static inline B b2{};
    constinit static inline B b1{};
};

int main() {
    A a;
}

Here b2 fails but b1 succeeds.
Comment 1 Marek Polacek 2019-10-10 20:08:23 UTC
Mine.
Comment 2 Marek Polacek 2019-10-25 14:37:00 UTC
Going to be fixed by https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01777.html
Comment 3 Marek Polacek 2019-11-08 21:41:16 UTC
Author: mpolacek
Date: Fri Nov  8 21:40:45 2019
New Revision: 277990

URL: https://gcc.gnu.org/viewcvs?rev=277990&root=gcc&view=rev
Log:
	PR c++/92058 - constinit malfunction in static data member.
	* g++.dg/cpp2a/constinit15.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp2a/constinit15.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 4 Marek Polacek 2019-11-08 21:42:00 UTC
Fixed.