[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#816366: g++-5: Illegal access to private field compiles



Package: g++-5
Version: 5.3.1-8
Severity: normal

Dear Maintainer,

Compiling the following on g++-5.3.1 does not produce an error although one is
expected:

% cat c.cc
#include <thread>
class X {
    int i;
};
main() {
    X x;
    std::thread([&x] { x.i = 3; });
}

g++-4.9 detects access to X::i which is private. Only happens in the sepcific
combination of a new thread and the lambda expression.

BR,
Gábor Németh

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (900, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.3.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=hu_HU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages g++-5 depends on:
ii  gcc-5            5.3.1-8
ii  gcc-5-base       5.3.1-8
ii  libc6            2.21-9
ii  libgmp10         2:6.1.0+dfsg-2
ii  libisl15         0.16.1-1
ii  libmpc3          1.0.3-1
ii  libmpfr4         3.1.3-2
ii  libstdc++-5-dev  5.3.1-8
ii  zlib1g           1:1.2.8.dfsg-2+b1

g++-5 recommends no packages.

Versions of packages g++-5 suggests:
pn  g++-5-multilib    <none>
ii  gcc-5-doc         5.2.0-1
pn  libstdc++6-5-dbg  <none>

-- no debconf information


Reply to: