[Bug c++/66294] New: Nonsensical warning message for address-of static member function expr through expr.B
jengelh at inai dot de
gcc-bugzilla@gcc.gnu.org
Tue May 26 23:17:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66294
Bug ID: 66294
Summary: Nonsensical warning message for address-of static
member function expr through expr.B
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: trivial
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jengelh at inai dot de
Target Milestone: ---
The following code:
struct F {
F &self(void) { return *this; };
static void test(void) { };
} f;
int main(void) { &f.self().test; }
yields the following compiler output:
t.cpp: In function ‘int main()’:
t.cpp:5:32: warning: right operand of comma operator has no effect
[-Wunused-value]
int main(void) { &f.self().test; }
However, there is no comma in the source at all. The warning is misleading.
This occurs for all known versions.
gcc version 5.1.1 20150518 [gcc-5-branch revision 223286] (SUSE Linux)
gcc version 4.9.0 (SUSE Linux)
gcc version 4.8.3 20140627 [gcc-4_8-branch revision 212064] (SUSE Linux)
What was expected:
[that which clang outputs, maybe?]
t.cpp:5:18: warning: expression result unused [-Wunused-value]
int main(void) { &f.self().test; }
^~~~~~~~~~~~~~
More information about the Gcc-bugs
mailing list