[Bug c++/105619] New: Wrong "used in its own initializer" with class prvalue
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon May 16 15:47:00 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105619
Bug ID: 105619
Summary: Wrong "used in its own initializer" with class prvalue
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
struct A {
const A *p = this;
};
constexpr A
bar (A)
{
return {};
}
constexpr A a = bar (A{});
constexpr auto *p = a.p; // #1
#1 is rejected with 'a' used in its own initializer:
$ ./cc1plus -quiet bug.C
bug.C:12:21: error: the value of ‘a’ is not usable in a constant expression
12 | constexpr auto *p = a.p; // #1
| ^
bug.C:11:13: note: ‘a’ used in its own initializer
11 | constexpr A a = bar (A{});
| ^
but 'a' is not actually used in the initializer?
More information about the Gcc-bugs
mailing list