-
Notifications
You must be signed in to change notification settings - Fork 15k
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"rejects-valid
Description
Bugzilla Link | 50634 |
Version | 12.0 |
OS | Linux |
CC | @DougGregor,@zygoloid |
Extended Description
Clang rejects this code:
template<bool = {}>
int f() {}
with:
error: expected expression
However I believe that the C++ grammar permits that.
[temp.param]:
The syntax for template-parameters is:
template-parameter:
type-parameter
parameter-declaration
[dcl.fct]:
parameter-declaration:
attribute-specifier-seq_{opt} decl-specifier-seq declarator
attribute-specifier-seq_{opt} decl-specifier-seq declarator = initializer-clause
attribute-specifier-seq_{opt} decl-specifier-seq abstract-declarator_{opt}
attribute-specifier-seq_{opt} decl-specifier-seq abstract-declarator
_{opt} = initializer-clause
[dcl.init]:
initializer-clause:
assignment-expression
braced-init-list
My motivating usecase is:
template<std::true_type = {}>
int f() {}
which is accepted by G++.
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"rejects-valid