[Bug c++/95468] New: ICE in expression sfinae
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95468 Bug ID: 95468 Summary: ICE in expression sfinae Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kab at acm dot org Target Milestone: --- The code below gets ICE with gcc9.2 and gcc7.5 (the versions I have immediately available to test with). The error message is: internal compiler error: unexpected expression '(bool)(true)' of kind cast_expr To test: g++ -c -std=c++11 ice-expr-sfinae.cpp Strangely, using a namespace scope function template instead of a static member function template works fine. To demonstrate that, compile with -DTRIGGER_ICE=0. - ice-expr-sfinae.cpp - #include #ifndef TRIGGER_ICE #define TRIGGER_ICE 1 #endif #if TRIGGER_ICE struct slip { template static constexpr bool condition() { return C; } }; template(), int>::type = 0> static bool dispatch() { return true; } bool test() { return dispatch(); } #else // No ICE if the condition function is at namespace scope. template static constexpr bool noslip_condition() { return C; } template(), int>::type = 0> static bool dispatch() { return true; } bool test() { return dispatch(); } #endif - end of file -
[Bug c++/95468] ICE in expression sfinae
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95468 --- Comment #1 from kab at acm dot org --- This was labeled as "ice-on-invalid-code". Am I missing something? I don't see anything invalid here.
[Bug tree-optimization/96951] strncpy truncation warning does not recognize truncation check
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96951 --- Comment #5 from kab at acm dot org --- (In reply to Martin Sebor from comment #3) > If in the code the test case was derived from the string > member is not necessarily meant to be a string then declaring it with > attribute nonstring avoids the warning: In the original code the string is intended to be a nul-terminated string. Also, its in a struct from a system header, so not modifiable. > As for memccpy... memccpy isn't so portable (think Windows, which deprecates it, though under the control of a macro). The code from the discussion that led here could cope with that, but that's not universally true.
[Bug c++/113760] gcc rejects valid empty-declaration in pedantic mode
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113760 kab at acm dot org changed: What|Removed |Added CC||kab at acm dot org --- Comment #5 from kab at acm dot org --- (In reply to Andrew Pinski from comment #3) > From JDK bug report: > > It looks like it only removed > > the warnings for empty declarations at namespace scope. I couldn't find > > anything for other cases, including empty class member declarations. > > Yes because the C++ defect report was only for `Spurious semicolons at > namespace scope should be allowed`. See > https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#569 . > > > ``` > struct f > { > int t; ; > }; > ``` > > Is not allowed by the C++ standard currently and is a GCC extension, maybe > it should have a seperate flag to control that but I am not 100% sure. It's C++14 that the openjdk currently cares about. C++14 added "empty-declaration" to the syntax for "member-declaration". C++14 9.2 [class.mem] https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1693 The above "struct f" declaration warns with C++14 and -Wpedantic, but shouldn't. Tested with that struct as the only contents of "test.cpp" and this command line for g++13.2.0: g++ -c -Wpedantic -std=c++14 -o test.o test.cpp