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

            Bug ID: 115651
           Summary: CTAD: gcc accepts the code which should be rejected.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hokein.wu at gmail dot com
  Target Milestone: ---

Consider the following code snippet:

```
template<typename T>
struct Out {
  template <typename U>
  struct Foo {
    Foo(U);
  };

  template <typename Y>
  requires false // always return false.
  using Alias1 = Foo<Y>;


  template <typename Z>
  using Alias2 = Alias1<Z>;
};

Out<int>::Alias2 s = 10;
```

The code should be rejected because of the always-false constraint on the
`Alias1`, but gcc accepts it, https://godbolt.org/z/czcsfezrv


If we remove remove the `Out` template class, gcc works as expected.

Reply via email to