Had a bunch of reports overnight (none last week) with this week's snapshot: ``` $ x86_64-pc-linux-gnu-g++ -c -o qglobal.o -O3 -march=native -fno-semantic-interposition -mtls-dialect=gnu2 -fdiagnostics-color=always -Wa,-O2 -Wa,-mtune=znver4 -pipe -Werror=strict-aliasi ng -Werror=lto-type-mismatch -Werror=odr -frecord-gcc-switches -ggdb3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -std=c++11 -ffunction-sections -fdata-sections -I/var/tmp/portage/dev-qt/qtco re-5.15.14/work/qtbase-everywhere-src-5.15.14/qmake -I/var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/qmake/library -I/var/tmp/portage/dev-qt/qtcore-5.15.14/wor k/qtbase-everywhere-src-5.15.14/qmake/generators -I/var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/src/3rdparty/tinycbor/src -I/var/tmp/portage/dev-qt/qtcore-5. 15.14/work/qtbase-everywhere-src-5.15.14/qmake/generators/unix -I/var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/qmake/generators/win32 -I/var/tmp/portage/dev-q t/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/qmake/generators/mac -I/var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/include -I/var/tmp/portage/dev-qt/qtc ore-5.15.14/work/qtbase-everywhere-src-5.15.14/include/QtCore -I/var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/include/QtCore/5.15.14 -I/var/tmp/portage/dev-qt /qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/include/QtCore/5.15.14/QtCore -I../src/corelib/global -I/var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/mkspe cs/linux-g++ -DQT_VERSION_STR=\"5.15.14\" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=15 -DQT_VERSION_PATCH=14 -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_FOREACH /var/tmp /portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/src/corelib/global/qglobal.cpp In file included from /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/include/QtCore/qglobalstatic.h:1, from /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/include/QtCore/../../src/corelib/global/qglobal.h:1310, from /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/include/QtCore/qglobal.h:1, from /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/mkspecs/linux-g++/qplatformdefs.h:45, from /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/src/corelib/global/qglobal.cpp:41: /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/include/QtCore/../../src/corelib/global/qglobalstatic.h:159:42: error: the value of ‘{anonymous}::Q_QGS_global_callback_table::guard’ is not usable in a constant expression 159 | Q_QGS_ ## NAME::guard> NAME; | ^~~~~ /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/include/QtCore/../../src/corelib/global/qglobalstatic.h:162:5: note: in expansion of macro ‘Q_GLOBAL_STATIC_WITH_ARGS’ 162 | Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ()) | ^~~~~~~~~~~~~~~~~~~~~~~~~ /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/src/corelib/global/qglobal.cpp:4316:1: note: in expansion of macro ‘Q_GLOBAL_STATIC’ 4316 | Q_GLOBAL_STATIC(QInternal_CallBackTable, global_callback_table) | ^~~~~~~~~~~~~~~ /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/include/QtCore/../../src/corelib/global/qglobalstatic.h:154:25: note: ‘{anonymous}::Q_QGS_global_callback_table::guard’ was not declared ‘constexpr’ 154 | QBasicAtomicInt guard = Q_BASIC_ATOMIC_INITIALIZER(QtGlobalStatic::Uninitialized); \ | ^~~~~ /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/include/QtCore/../../src/corelib/global/qglobalstatic.h:162:5: note: in expansion of macro ‘Q_GLOBAL_STATIC_WITH_ARGS’ 162 | Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ()) | ^~~~~~~~~~~~~~~~~~~~~~~~~ /var/tmp/portage/dev-qt/qtcore-5.15.14/work/qtbase-everywhere-src-5.15.14/src/corelib/global/qglobal.cpp:4316:1: note: in expansion of macro ‘Q_GLOBAL_STATIC’ 4316 | Q_GLOBAL_STATIC(QInternal_CallBackTable, global_callback_table) | ^~~~~~~~~~~~~~~ gmake: *** [Makefile:343: qglobal.o] Error 1 gmake: *** Waiting for unfinished jobs.... ``` I haven't tried to look at it yet but my C++ isn't great either anyway. --- ``` Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/15/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-15.0.0_pre20240929/work/gcc-15-20240929/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/15 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/15/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=yes,extra,rtl --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 15.0.0_pre20240929 p13' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-build-config='bootstrap-O3 bootstrap-lto bootstrap-cet' Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 15.0.0 20240929 (experimental) (Gentoo Hardened 15.0.0_pre20240929 p13) ```
Created attachment 59241 [details] qlogging.ii.xz
``` template <int &> struct a {}; namespace { namespace Q_QGS_global_callback_table { int guard; } } // namespace a<Q_QGS_global_callback_table::guard> b; ``` rejected by gcc w/ -std=c++11 accepted by gcc w/ -std=c++17 accepted by clang w/ -std=c++11 accepted by clang w/ -std=c++17 Is this OK?
edg accepts it with 11 too
Slightly more reduced: ``` template <int &> struct a {}; namespace { int guard; } a<guard> b; ``` YES this should be accepted with C++11. Anonynous namespaces are still considered external linkage; even though they get localized.
Note we should accept this for C++11 too: ``` template <int &> struct a {}; static int guard; a<guard> b; ``` But that has always been rejected. clang warns about the original reduced testcase for c++98 but that is valid as anonymous namespaces are not local linkage in C++98 (even though they are localized).
r15-3910-gaf4471cb422a86 I'm not convinced that even in C++98 it was intended that e.g. types in anonymous namespaces should be external, but some tests in the testsuite rely on this, so for compatibility I restricted those modifications to C++11 and later.
comment #5 is PR 113266.
(In reply to Andrew Pinski from comment #7) > comment #5 is PR 113266. Which I think is the underyling issue here, just exposed by r15-3910-gaf4471cb422a86 change.
Patch submitted: https://gcc.gnu.org/pipermail/gcc-patches/2024-October/664449.html Sorry about the breakage.
(In reply to Nathaniel Shead from comment #9) > Patch submitted: > https://gcc.gnu.org/pipermail/gcc-patches/2024-October/664449.html > > Sorry about the breakage. No worries, it's part of the fun and point of testing stuff early en-masse. Thank you!
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>: https://gcc.gnu.org/g:247643c7e21b087e6c93b8b8d49b4268bf84b03b commit r15-4061-g247643c7e21b087e6c93b8b8d49b4268bf84b03b Author: Nathaniel Shead <nathanieloshead@gmail.com> Date: Fri Oct 4 12:01:38 2024 +1000 c++: Allow references to internal-linkage vars in C++11 [PR113266] [temp.arg.nontype] changed in C++11 to allow naming internal-linkage variables and functions. We currently already handle internal-linkage functions, but variables were missed; this patch updates this. PR c++/113266 PR c++/116911 gcc/cp/ChangeLog: * parser.cc (cp_parser_template_argument): Allow internal-linkage variables since C++11. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nontype6.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Should be fixed on trunk, thanks!