https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119736

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(The following are the links from comment 0; comment 0 also shows the actual
C++ code under the link.)

Example 1: https://godbolt.org/z/aE7xEnzzq
Example 2: https://godbolt.org/z/EEjMj9ab4

→  ICE with GCC 15 -std=c++17
→  Error with GCC 14 -std=c++17 / -std=C++14 | GCC 15 -std=c++14

→ ICE is a '15 Regression' - as mentioned in comment 0

* * *

First example:

* Clang (trunk-std=c++14, -std=c++17, -std=c++26) rejects the first one with:
  error: reference to temporary object is not allowed in a template argument

* GCC 14 (-std=c++14 / -std=c++17) rejects it with:
  error: the address of 'make_static_ref<42>::<temporary>' is not a valid
template argument

* GCC 15 (when not ICEing, i.e. with -std=14) rejects it with:
  error: 'constexpr const int& make_static_ref<42>::ref' is not a valid
template argument for type 'const int&' because a reference variable does not
have a constant address

* * *

Second example:

* Clang (trunk; -std=c++14, -std=c++17, -std=c++26) rejects the second one
with:
  error: explicit instantiation of 'takes_static_ref_f' does not refer to a
function template, variable template, member function, member class, or static
data member

* GCC 14 (-std=c++14 / -std=c++17) and
  GCC 15 -std=c++14 rejects it with:
  error: template-id 'takes_static_ref_f<make_static_ref<42>::ref>' for 'void
takes_static_ref_f()' does not match any template declaration

Reply via email to