-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
Description
The following code doesn't compile due to failed static assertion in Clang, but does compile in MSVC:
struct A
{
template <int=0>
constexpr A() noexcept {}
};
struct B : A
{
using A::A;
explicit constexpr B(int) noexcept {}
};
struct C : B
{
using B::B;
template <int=0>
constexpr C() noexcept : a(1) {}
int a = 0;
};
static_assert(C().a == 1);This is not standard compliant, that code should compile. According to the standard A's constructor is not a default constructor per-se, as in "special member function" kind of default constructor -- it is a template for a constructor that takes no arguments, thus A does not have an implicit default constructor, so nor should B which inherits from it and its constructor using the using declaration. But clang seems to think here that because A is default-constructible (which it is, despite not having "real" default constructor), that B should get an implicit default constructor.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue