| Summary: | A nested lambda fails to find a protected name with qualified name | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Ville Voutilainen <ville.voutilainen> |
| Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | daniel.kruegler, jason, jengelh |
| Priority: | P3 | Keywords: | c++-lambda |
| Version: | 4.9.0 | ||
| Target Milestone: | 5.0 | ||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | ||
| Bug Depends on: | |||
| Bug Blocks: | 54367 | ||
Author: jason Date: Mon Jun 2 20:47:55 2014 New Revision: 211147 URL: http://gcc.gnu.org/viewcvs?rev=211147&root=gcc&view=rev Log: PR c++/59483 PR c++/61148 * search.c (accessible_p): Use current_nonlambda_class_type. * semantics.c (check_accessibility_of_qualified_id): Likewise. Added: trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-59483.C trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-61148.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/search.c trunk/gcc/cp/semantics.c It seems that 58972 is a duplicate, and is fixed by the same patch. So, correction, the original testcase in 58972 is fixed by this patch, but the other testcase in it ICEs the compiler. That testcase is not really related to the issue the patch fixes, or the patch itself, it seems separate, and we could certainly create a separate bug for it, but I guess it can be fixed under the auspices of 58972. Fixed on trunk. |
Test: struct X { protected: int i; }; struct Y: X { void f() { [&]{ X::i = 3; }(); } // #1 }; Output: eelis.cpp: In lambda function: eelis.cpp:3:7: error: ‘int X::i’ is protected int i; ^ eelis.cpp:8:13: error: within this context [&]{ X::i = 3; }(); } ^ Removing X:: from #1 makes it work. Clang 3.4 accepts the code either with X:: or without it.