[Bug c++/51494] New: Legal program rejection - capturing "this" when using static method inside lambda
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51494 Bug #: 51494 Summary: Legal program rejection - capturing "this" when using static method inside lambda Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ulid...@gmail.com Consider the following source code: struct A { static void f() {} void foo() { [] () { f(); }; } }; GCC 4.6.1 produces the following error message when compiling it: test.cpp: In lambda function: test.cpp:7:27: error: ‘this’ was not captured for this lambda function However, the member function f is static and it's call doesn't use 'this'; therefore the lambda need not to capture 'this'. The code shall compile.
[Bug preprocessor/89038] New: #pragma GCC diagnostic ignored "-Wunknown-pragmas" does not work
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89038 Bug ID: 89038 Summary: #pragma GCC diagnostic ignored "-Wunknown-pragmas" does not work Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: ulidtko at gmail dot com Target Milestone: --- Consider this test.cxx file: ---8< #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wunknown-pragmas" // this gets silenced correctly (by line 2) #pragma GCC diagnostic ignored "-Wfoobar-unknown-gcc-pragma" // this still emits "-Wunknown-pragmas", despite line 3 #pragma clang diagnostic ignored "-Wfoobar-unknown-clang-pragma" int main() {} #pragma GCC diagnostic pop ---8< g++ -Wall -Werror test.cxx test.cxx:9:0: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas] #pragma clang diagnostic ignored "-Wfoobar-unknown-clang-pragma" This happens despite the fact that "-Wunknown-pragmas" is explicitly silenced in line 3. Adding -Wno-unknown-pragmas to the command line works as expected; however, I expect the in-source #pragma to work as well. But it doesn't. g++ (GCC) 7.2.1 20180104 (Red Hat 7.2.1-5) Bug #53431 seems closely related.
[Bug c++/89038] #pragma GCC diagnostic ignored "-Wunknown-pragmas" does not work
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89038 --- Comment #3 from Maxim Ivanov --- (In reply to Eric Gallager from comment #2) > I think this is a dup of something but I can't remember the bug number right > now; I'll search harder later... Eric, take a look at bug #53431, I think that's what you meant. It's a pretty similar report about in-source pragmas not working in C++. Further, that thread contains a WIP patch from Manuel López-Ibáñez, which he expressly abandoned while encouraging others to finish and merge it. P.S. I do harbor a hope to resolve this on my own, once I accumulate the necessary courage to allocate some time for a little GCC contribution. That's why I'm reporting a separate issue knowing it's a duplicate :)