<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64719>64719</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc++] _LIBCPP_CTAD_SUPPORTED_FOR_TYPE does not work for out of class defined nested classes
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          crtrott
      </td>
    </tr>
</table>

<pre>
    I ran into this problem with mdspan layouts, when I tried to rely on the implicitly defined deduction guides.
That works but produces a warning with `-Wctad-maybe-unsupported` on the compile line.

It was suggested to use `_LIBCPP_CTAD_SUPPORTED_FOR_TYPE` but that gives a compile error: https://godbolt.org/z/7n48snYfb

Adding the deduction guide explicitly in the `layout_left` class leads to this warning:
```
__fwd/mdspan.h:55:3: error: unused function template '<deduction guide for mapping>' [-Werror,-Wunused-template]
   55 | mapping(_Extents, array<_OtherIndexType, _Extents::rank>) -> mapping<_Extents>;
```
which I can silence with a `[[maybe_unused]]`

Here is the code reproducer:
```c++
#include <__config>
#include<array>

struct layout_left {
  template<class E> 
  struct mapping;
 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(mapping);
};

template<class E> 
struct layout_left::mapping {
  template<class T>
  mapping(E e, std::array<T, 1> a) {}
};


void func() {
 layout_left::mapping m(5, std::array<int,1>{1});
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVU2P4jgQ_TXmUgIFu0PIgQME0CKtNK1ZVqM5RU5cId5x7Mh2mmZ__coxoXt7vqTI3dipeq9evZS5c_KiETck3ZF0P-ODb43d1NZb4_2sMuK2OYHlGqT2BnwrHfTWVAo7uErfQidczzUofjODd4QWcG1Rwwm8lSjAG7CobmA0-BZBdr2StfTqBgIbqVGAQDHUXhoNl0EKdAuS7EmyPbfcw9XYbw6qwQdMMdTogMOVWy31JcKTVT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