Skip to content

Wrong result of "constructible" traits for unbound arraysΒ #140303

@bolshakov-a

Description

@bolshakov-a

These asserts fail in Clang (and GCC as well) even in the C++20 mode:

static_assert(__is_constructible(int[], int, int));
static_assert(__is_nothrow_constructible(int[], int, int));

However, it seems to be wrong because [meta.unary.prop] p. 9 states:

The predicate condition for a template specialization is_constructible<T, Args...> shall be satisfied if and only if the following variable definition would be well-formed for some invented variable t:
T t(declval<Args>()...);

and the following compiles (C++20 and later):

#include <type_traits>

template< class T >
std::add_rvalue_reference_t<T> declval() noexcept;

using T = int[];

T t(declval<int>(), declval<int>());

It looks correct according to [dcl.init.general] p. 16.5:

... If the destination type is an array of unknown bound, it is defined as having k elements.

Is it actually a bug, or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions