Package: g++-6 Version: 6.1.1-8 Severity: normal Dear maintainer,
I've got a wired behavior with the attached test case: I can compile the file without problems when I specify -std=c++03. However, with -std=c++11 I get an error in line 11: error: enum test::enu is not a class or namespace: friend test::enu ::wow(); This happens with both g++5 and g++6. Obviously, when I remove the "::" before "wow" then I get an error in line 35 because now the friend declaration is assumed to be in the namespace "fun" (as it should be) and the "wow" function defined in the global namespace is not assumed to be friend. If I declare wow() to be of return type "int" then everything works as expected. Since the code in question that brought me here is in part generated by bison (cf: #811992) the only way I currently see to quell this problem and fix that bug is to force -std=c++03. Best, Gert -- System Information: Debian Release: stretch/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.6.0-1-amd64 (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages g++-6 depends on: ii gcc-6 6.1.1-8 ii gcc-6-base 6.1.1-8 ii libc6 2.22-13 ii libgmp10 2:6.1.1+dfsg-1 ii libisl15 0.17.1-1 ii libmpc3 1.0.3-1 ii libmpfr4 3.1.4-2 ii libstdc++-6-dev 6.1.1-8 ii zlib1g 1:1.2.8.dfsg-2+b1 g++-6 recommends no packages. Versions of packages g++-6 suggests: pn g++-6-multilib <none> pn gcc-6-doc <none> pn libstdc++6-6-dbg <none> -- no debconf information
namespace test { enum enu {A, B}; }; test::enu wow(); namespace fun { class G { friend test::enu ::wow(); G(); test::enu k; }; class H { public: H(); test::enu i; }; G::G(): k(test::A) { } H::H() { i = wow(); } } test::enu wow() { fun::G g; return g.k; } int main(int, char**) { fun::morefun::H h; return static_cast<int>(h.i); }