[Bug c++/107124] Reference template parameter refers to a temporary object

2022-10-31 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107124 Marek Polacek changed: What|Removed |Added CC||mpolacek at gcc dot gnu.org Ever co

[Bug c++/107124] Reference template parameter refers to a temporary object

2022-10-30 Thread fchelnokov at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107124 --- Comment #3 from Fedor Chelnokov --- The latter example is indeed a bug in MSVC: https://developercommunity.visualstudio.com/t/Cannot-find-template-function-with-expli/1672180 And here is the related discussion according the original issue:

[Bug c++/107124] Reference template parameter refers to a temporary object

2022-10-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107124 --- Comment #2 from Andrew Pinski --- Here is one which GCC/clang agree and accepts but MSVC/ICC reject (even before the static assert): template struct A {}; template constexpr int f(A) { return 0; } template constexpr int f(T) { return 1; } co

[Bug c++/107124] Reference template parameter refers to a temporary object

2022-10-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107124 --- Comment #1 from Andrew Pinski --- MSVC also invokes the static assert but ICC accepts it. Note I think clang/ICC get the following wrong too: template struct A {}; template constexpr int f(A) { return 0; } template constexpr int f(T) { ret