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

            Bug ID: 106289
           Summary: Value of polymorphic type as template argument
           Product: gcc
           Version: 13.0
            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/4jGn1fsc8.

```C++
struct B {
  virtual ~B() = default;
};

template<auto> long y;
long z = y<B{}>;
```

```
<source>:6:10: error: '((& B::_ZTV1B) + 16)' is not a valid template argument
for 'int (**)(...)' because it is not the address of a variable
    6 | long z = y<B{}>;
      |          ^~~~~~
Compiler returned: 1
```

Reply via email to