Skip to content

[clang] Variadic concept defined in terms of another concept improperly cached #161983

@davidstone

Description

@davidstone

The following valid translation unit

template<bool b>
concept bool_ = b;

template<typename... Ts>
concept unary = bool_<sizeof...(Ts) == 1>;

static_assert(!unary<>);
static_assert(unary<void>);

causes clang to fail with

<source>:8:15: error: static assertion failed
    8 | static_assert(unary<void>);
      |               ^~~~~~~~~~~
<source>:8:15: note: because 'void' does not satisfy 'unary'
<source>:5:17: note: because 'sizeof...(Ts) == 1' does not satisfy 'bool_'
    5 | concept unary = bool_<sizeof...(Ts) == 1>;
      |                 ^
<source>:2:17: note: because 'false' evaluated to false
    2 | concept bool_ = b;
      |                 ^
1 error generated.
Compiler returned: 1

Commenting out either static assert causes the failure to go away. This was introduced by 9583b39 @cor3ntin @zyn0217

See it live: https://godbolt.org/z/r5nPr5TKe

Metadata

Metadata

Assignees

Labels

clang:frontendLanguage frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsregression

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions