-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Labels
accepts-invalidbugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second party
Description
| Bugzilla Link | 41561 |
| Version | trunk |
| OS | All |
| Reporter | LLVM Bugzilla Contributor |
| CC | @hfinkel,@randomnetcat,@darkbuck,@riccibruno,@zygoloid |
Extended Description
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() {
}
Metadata
Metadata
Assignees
Labels
accepts-invalidbugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second party