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

            Bug ID: 99493
           Summary: Address of template parameter object is not a valid
                    template argument
           Product: gcc
           Version: 11.0
               URL: https://godbolt.org/z/9zYo8f
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/9zYo8f.
```C++
struct owner{int m;};
struct view{const int*m;constexpr view(const owner&o):m{&o.m}{}};
template<view V>struct constant{};
template<owner O>constexpr constant<O>v{};
[[maybe_unused]] constexpr auto a=v<owner{}>;
```
https://timsong-cpp.github.io/cppwp/n4861/temp.param#8 defines template
parameter object.
https://timsong-cpp.github.io/cppwp/n4861/temp.arg.nontype#2 makes the template
parameter object a constant expression.
https://timsong-cpp.github.io/cppwp/n4861/temp.arg.nontype#3 lists
restrictions, which excludes taking the address of a template parameter object.

Reply via email to