| Issue |
160982
|
| Summary |
Clang fails to merge default template arguments across multiple declarations of a member class template within a class template
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
NylteJ
|
Similar to #135442, but for class templates.
Clang rejects this code, while MSVC, GCC, and EDG accept it ([godbolt](https://godbolt.org/z/44fr4814G)):
```cpp
template <class>
struct Foo {
template <class T = int>
struct Bar;
template <class T>
struct Bar {};
using MyBar = Bar<>;
};
template struct Foo<void>;
```
According to [[temp.param]/18](https://eel.is/c++draft/temp.param#18), the default arguments for `Bar` should be merged, so this code should be valid.
Notably, the issue disappears if:
- the enclosing class is non-template, or
- the default argument is placed on the definition rather than the declaration ([godbolt](https://godbolt.org/z/z5nbdWTso)).
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs