-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 conceptsconfirmedVerified by a second partyVerified by a second party
Description
Bugzilla Link | 51503 |
Version | trunk |
OS | Linux |
CC | @AaronBallman,@JohelEGP,@zygoloid |
Extended Description
Hi clang-team,
the following code does not compile with clang trunk:
template <typename urng_t>
struct contiguous_range
{
template <bool const_range>
requires (const_range == false)
using basic_iterator = int;
auto begin()
{
return basic_iterator<false>{};
}
};
https://godbolt.org/z/jobYveoe3
with the error
<source>:5:19: error: substitution into constraint expression resulted in a non-constant expression
requires (const_range == false)
^~~~~~~~~~~~~~~~~~~~
<source>:10:16: note: while checking constraint satisfaction for template 'basic_iterator<false>' required here
return basic_iterator<false>{};
^~~~~~~~~~~~~~~~~~~~~
<source>:5:19: note: subexpression not valid in a constant expression
requires (const_range == false)
^
MSVC 16.11, and gcc 11.2 are able to compile this code. A curious side note: If you remove template <typename urng_t>
clang does compile this code snippet.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 conceptsconfirmedVerified by a second partyVerified by a second party
Type
Projects
Status
Done