[llvm-bugs] [Bug 49609] decltype of template parameter object is not const

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 16 16:37:14 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49609

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
Clang's behavior is correct. `decltype(V)`, where `V` is an id-expression,
produces the type of the entity denoted by `V`, not the type of the expression.
See [dcl.type.decltype]/1.2:

"if E is an unparenthesized id-expression naming a non-type template-parameter
(13.2), decltype(E) is the type of the template-parameter after performing any
necessary type deduction (9.2.9.6, 9.2.9.7);"

Per [temp.param](13.2)/6, the type of the template parameter is not
const-qualified, even though (per (13.2)/8) the type of the template parameter
object is.

So decltype(V) in this case is 'A', but decltype((V)) is 'const A&'.

-- 
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/4e0afe5b/attachment.html>


More information about the llvm-bugs mailing list