[llvm-bugs] [Bug 49609] New: decltype of template parameter object is not const
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Mar 16 13:06:37 PDT 2021
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: unassignedclangbugs at nondot.org
Reporter: johelegp at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
johelegp at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210316/c7a0d60c/attachment.html>
More information about the llvm-bugs
mailing list