https://bugs.llvm.org/show_bug.cgi?id=50634
Bug ID: 50634
Summary: Clang rejects braced-init-list as default non-type
template parameter
Product: clang
Version: 12.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: pilarlati...@gmail.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
Clang rejects this code:
```c++
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:
```c++
template<std::true_type = {}>
int f() {}
```
which is accepted by G++.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs