https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100983
Bug ID: 100983
Summary: Deduction guide for member template class rejected at
class scope
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: brycelelbach at gmail dot com
Target Milestone: ---
```
struct X {
template <unsigned N>
struct Y {
template <typename... Ts>
Y(Ts...) {}
};
template <typename... Ts>
Y(Ts...) -> Y<sizeof...(Ts)>;
};
```
I'm fairly confident this is legal code, but GCC rejects it, stating that a
deduction guide is only allowed at namespace scope.
http://eel.is/c++draft/temp.deduct.guide#3.sentence-4 says:
"A deduction-guide shall inhabit the scope to which the corresponding class
template belongs and, for a member class template, have the same access."
... which suggests to me that it is allowed.
https://godbolt.org/z/cWa69scjW