From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18187 invoked by alias); 11 May 2014 23:09:08 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18150 invoked by uid 48); 11 May 2014 23:09:00 -0000 From: "ville.voutilainen at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61148] New: Cannot access protected members from a lambda capturing this Date: Sun, 11 May 2014 23:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ville.voutilainen at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg00964.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D61148 Bug ID: 61148 Summary: Cannot access protected members from a lambda capturing this Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ville.voutilainen at gmail dot com Test: class DB { protected: void foo() {}; }; class DC : public DB { public: DC() { [this]() { DB::foo(); // #1 }(); }; }; int main(void) { DC x; } This is potentially a duplicate of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D58972 Clang accepts the code. gcc prints lambda-protected.cpp: In lambda function: lambda-protected.cpp:3:14: error: =E2=80=98void DB::foo()=E2=80=99 is prote= cted void foo() {}; ^ lambda-protected.cpp:9:33: error: within this context DB::foo(); ^ And changing #1 to this->DB::foo(); does not help. >>From gcc-bugs-return-451273-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun May 11 23:12:07 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 19479 invoked by alias); 11 May 2014 23:12:05 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 19450 invoked by uid 48); 11 May 2014 23:11:59 -0000 From: "jengelh at inai dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61149] New: g++ rejects invocation of protected base class function from lambda Date: Sun, 11 May 2014 23:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jengelh at inai dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg00965.txt.bz2 Content-length: 2092 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D61149 Bug ID: 61149 Summary: g++ rejects invocation of protected base class function from lambda Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jengelh at inai dot de gcc-4.9.0 SVN r209782 and gcc 4.8.2 reject this code: class B { protected: void foo(void) {}; }; class S : public B { public: S(void) { [this](void) { B::foo(); }(); }; }; $ g++ -c q.cpp -std=3Dgnu++11 q.cpp: In lambda function: q.cpp:4:7: error: =E2=80=98void B::foo()=E2=80=99 is protected void foo(void) {}; ^ q.cpp:9:25: error: within this context [this](void) { B::foo(); }(); ^ $ g++ -v Using built-in specs. COLLECT_GCC=3Dg++ COLLECT_LTO_WRAPPER=3D/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper Target: x86_64-suse-linux Configured with: ../configure --prefix=3D/usr --infodir=3D/usr/share/info --mandir=3D/usr/share/man --libdir=3D/usr/lib64 --libexecdir=3D/usr/lib64 --enable-languages=3Dc,c++,objc,fortran,obj-c++,java,ada --enable-checking=3Drelease --with-gxx-include-dir=3D/usr/include/c++/4.8 --enable-ssp --disable-libssp --disable-plugin --with-bugurl=3Dhttp://bugs.opensuse.org/ --with-pkgversion=3D'SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=3D/lib64 --with-system= -zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=3Dnew --disable-libstdcx= x-pch --enable-version-specific-runtime-libs --enable-linker-build-id --enable-linux-futex --program-suffix=3D-4.8 --without-system-libunwind --with-arch-32=3Di586 --with-tune=3Dgeneric --build=3Dx86_64-suse-linux --host=3Dx86_64-suse-linux Thread model: posix gcc version 4.8.2 20140404 [gcc-4_8-branch revision 209122] (SUSE Linux)=20 clang is fine with it: $ clang++ -c q.cpp -std=3Dgnu++11 $ clang++ -v clang version 3.3 (branches/release_33 183898) Target: x86_64-suse-linux Thread model: posix >>From gcc-bugs-return-451274-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun May 11 23:16:46 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 21317 invoked by alias); 11 May 2014 23:16:45 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 21289 invoked by uid 48); 11 May 2014 23:16:40 -0000 From: "jengelh at inai dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61148] Cannot access protected members from a lambda capturing this Date: Sun, 11 May 2014 23:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jengelh at inai dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg00966.txt.bz2 Content-length: 450 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61148 Jan Engelhardt changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jengelh at inai dot de --- Comment #1 from Jan Engelhardt --- Definitely a duplicate of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61149 ;)