-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Description
| Bugzilla Link | 10815 |
| Version | trunk |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor |
Extended Description
This invalid program gives a diagnostic that could be better:
struct X { void foo(); };
void t() {
X x;
void (X::*y)() = &X::foo;
x.*y();
}These member-pointer things are hard (though fortunately rare), so a good compiler diagnostic would be really helpful. The error is:
x.cc:6:7: error: called object type 'void (X::*)()' is not a function or
function pointer
x.*y();
~^while gcc gives me this:
x.cc: In function ‘void t()’:
x.cc:6: error: must use ‘.*’ or ‘->*’ to call pointer-to-member function in ‘y (...)’, e.g. ‘(... ->* y) (...)’which actually showed me that I needed to insert the parens. Nice.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer