This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61149] New: g++ rejects invocation of protected base class function from lambda
- From: "jengelh at inai dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 11 May 2014 23:11:54 +0000
- Subject: [Bug c++/61149] New: g++ rejects invocation of protected base class function from lambda
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61149
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=gnu++11
q.cpp: In lambda function:
q.cpp:4:7: error: âvoid B::foo()â 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=g++
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8
--enable-ssp --disable-libssp --disable-plugin
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib
--enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --enable-linker-build-id
--enable-linux-futex --program-suffix=-4.8 --without-system-libunwind
--with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
--host=x86_64-suse-linux
Thread model: posix
gcc version 4.8.2 20140404 [gcc-4_8-branch revision 209122] (SUSE Linux)
clang is fine with it:
$ clang++ -c q.cpp -std=gnu++11
$ clang++ -v
clang version 3.3 (branches/release_33 183898)
Target: x86_64-suse-linux
Thread model: posix