[Bug c++/114220] False positive warning: possibly dangling reference to a temporary [-Wdangling-reference]

2024-03-04 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114220 Xi Ruoyao changed: What|Removed |Added CC||asharafutdinov at adalisk dot com --- Comm

[Bug c++/114220] False positive warning: possibly dangling reference to a temporary [-Wdangling-reference]

2024-03-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114220 --- Comment #4 from Andrew Pinski --- (In reply to Дилян Палаузов from comment #3) > > The warning is designed this way explictly because you are returning a > > reference and taking a reference as an argument and in the case of b2, the > > te

[Bug c++/114220] False positive warning: possibly dangling reference to a temporary [-Wdangling-reference]

2024-03-03 Thread dilyan.palauzov at aegee dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114220 --- Comment #3 from Дилян Палаузов --- > The warning is designed this way explictly because you are returning a > reference and taking a reference as an argument and in the case of b2, the > tempory is `std::string("u")` . > In GCC 14+ (since

[Bug c++/114220] False positive warning: possibly dangling reference to a temporary [-Wdangling-reference]

2024-03-03 Thread dilyan.palauzov at aegee dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114220 --- Comment #2 from Дилян Палаузов --- Is my reading correct, that the warning is triggered, when a function receives as parameter a reference to a temporary and returns a reference? If this is the only criterion, then it is a wrong assumption,

[Bug c++/114220] False positive warning: possibly dangling reference to a temporary [-Wdangling-reference]

2024-03-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114220 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---