https://bugs.llvm.org/show_bug.cgi?id=49609
Bug ID: 49609
Summary: decltype of template parameter object is not const
Product: clang
Version: trunk
Hardware: PC
URL: https://godbolt.org/z/P53nro
OS: Linux
Status: NEW
Keywords: compile-fail
Severity: enhancement
Priority: P
Component: C++2a
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
According to https://timsong-cpp.github.io/cppwp/n4861/temp.param#8,
> An id-expression naming a non-type template-parameter of class type T denotes
> a static storage duration object of type const T, known as a template
> parameter object [...]
See https://godbolt.org/z/P53nro.
```C++
#include<type_traits>
template<auto V>constexpr bool is_const{std::is_const_v<decltype(V)>};
struct A{};
static_assert(is_const<A{}>);
const A a;
static_assert(std::is_const_v<decltype(a)>);
```
```
C++
7
<source>:5:1: error: static_assert failed due to requirement 'is_const<A{}>'
static_assert(is_const<A{}>);
^ ~~~~~~~~~~~~~
1 error generated.
Compiler returned: 1
```
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs