[llvm-bugs] [Bug 41561] New: decltype(&(C::member)) yields pointer-to-member type
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Apr 22 14:55:24 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41561
Bug ID: 41561
Summary: decltype(&(C::member)) yields pointer-to-member type
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: csmate at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
In some contexts, decltype(&(C::member)) yields a pointer to member type, but
according to [expr.unary.op]/4, no pointer to member should be formed when the
operand of the & operator is enclosed in parentheses.
http://eel.is/c++draft/expr.unary.op#4
The code below demonstrates this behavior. It compiles on all Clang versions I
have tried between 3.2 and HEAD, even though I don't think it should.
```
#include <type_traits>
struct S {
int x;
static_assert(std::is_same<decltype(&(S::x)), int S::*>::value, ""); // !
void foo() {
static_assert(std::is_same<decltype(&(S::x)), int*>::value, ""); // OK
}
};
static_assert(std::is_same<decltype(&(S::x)), int S::*>::value, ""); // !
int main() {
}
```
--
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/20190422/a805ea77/attachment.html>
More information about the llvm-bugs
mailing list