-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
Description
Similar to #135442, but for class templates.
Clang rejects this code, while MSVC, GCC, and EDG accept it (godbolt):
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, 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).
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue