[Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9

2024-04-30 Thread de34 at live dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388 --- Comment #10 from Jiang An --- Broken down into two smaller examples: https://godbolt.org/z/YhK7PqE6s ``` #include #include int main() { struct B { B() {} virtual ~B() { std::puts("C++11"); } }; struct C { B b; };

[Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9

2024-03-19 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388 --- Comment #9 from Jonathan Wakely --- If there's a bug here, it's the value category of the ternary expression, not a problem with typeid. Whether there's a problem with the value category depends on how the DR is interpreted to apply to

[Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9

2024-03-19 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388 --- Comment #8 from Jonathan Wakely --- The change makes the value category clk_rvalueref but I don't know what that means in C++98 mode: op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0)); + if (op1_lvalue_kind == clk_class) +

[Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9

2024-03-19 Thread de34 at live dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388 --- Comment #7 from Jiang An --- (In reply to Jonathan Wakely from comment #5) > Prior to DR 616 the expression (true ? WrapB().b : WrapD().d) was a prvalue > of type B, created by copying the B (or slicing the D when the condition is > false).

[Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9

2024-03-19 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388 --- Comment #6 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #5) > In C++98 the const B& is an lvalue, and in C++11 the B&& is an xvalue which > is a glvalue. Either way, it's correct to treat it as a glvalue of >

[Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9

2024-03-19 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388 --- Comment #5 from Jonathan Wakely --- Prior to DR 616 the expression (true ? WrapB().b : WrapD().d) was a prvalue of type B, created by copying the B (or slicing the D when the condition is false). As an rvalue, it wasn't evaluated. That's

[Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9

2024-03-19 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388 --- Comment #4 from Jonathan Wakely --- This changed with r9-595-g955da5e5443724: CWG 616, 1213 - value category of subobject references. * tree.c (lvalue_kind): A reference to a subobject of a prvalue is an

[Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9

2024-03-19 Thread de34 at live dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388 --- Comment #3 from Jiang An --- (In reply to Richard Biener from comment #2) > So you say GCC 9+ are wrong with -std=c++98 but OK with -std=c++11 or newer > (the default)? Yes.

[Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9

2024-03-19 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388 Richard Biener changed: What|Removed |Added CC||jason at gcc dot gnu.org --- Comment

[Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9

2024-03-19 Thread de34 at live dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388 --- Comment #1 from Jiang An --- Moreover, perhaps we should list N3055 in the implementation status page (https://gcc.gnu.org/projects/cxx-status.html) since it did contain behavioral change of typeid.