-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
Description
Here is a tiny program that shows std::is_default_constructible_v is happy with a struct that contains a member initializer:
#include <type_traits>
struct Foo {
int a = 0;
};
static_assert(std::is_default_constructible_v<Foo>);This compiles fine with -std=c++17. It also works fine if we embed the struct inside of another one:
#include <type_traits>
struct Bar {
struct Baz {
int a = 0;
};
};
static_assert(std::is_default_constructible_v<Bar::Baz>);However if we add another type trait use inside of the parent struct, then both type trait assertions fail:
#include <type_traits>
struct Bar {
struct Baz {
int a = 0;
};
static_assert(std::is_default_constructible_v<Baz>);
};
static_assert(std::is_default_constructible_v<Bar::Baz>);<source>:8:3: error: static assertion failed due to requirement 'std::is_default_constructible_v<Bar::Baz>'
static_assert(std::is_default_constructible_v<Baz>);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:11:1: error: static assertion failed due to requirement 'std::is_default_constructible_v<Bar::Baz>'
static_assert(std::is_default_constructible_v<Bar::Baz>);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This seems wrong—Baz is already a complete type at the point that the assertion inside Bar is made, right?
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:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue