public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here
@ 2024-05-03  8:54 slyfox at gcc dot gnu.org
  2024-05-03  9:05 ` [Bug c++/114933] " slyfox at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: slyfox at gcc dot gnu.org @ 2024-05-03  8:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114933

            Bug ID: 114933
           Summary: [15 Regression] mcfgthread-1.6.1 typecheck failure:
                    error: explicit specializations are not permitted here
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

mcfgthread-1.6.1 build failure started happening a few days ago on `gcc`
`master`. On r15-116-gff4dc8b10a421c minimized example failure looks this way:

    // $ cat a.cc
    extern "C++" template<bool> struct __MCF_static_assert;
    extern "C++" template<> struct __MCF_static_assert<true> { };

Fails as:

$ g++ -c a.cc -std=c++20
a.cc:2:14: error: explicit specializations are not permitted here
    2 | extern "C++" template<> struct __MCF_static_assert<true> { };
      |              ^~~~~~~~~~

For comparison 13.2.0 builds the example successfully:

$ g++-13.2.0 -c a.cc -std=c++20
<ok>

Compiler details:

$ g++ -v |& unnix
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-15.0.0/bin/g++
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-15.0.0/libexec/gcc/x86_64-unknown-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../source/configure --prefix=/<<NIX>>/gcc-15.0.0
--with-gmp-include=/<<NIX>>/gmp-6.3.0-dev/include
--with-gmp-lib=/<<NIX>>/gmp-6.3.0/lib
--with-mpfr-include=/<<NIX>>/mpfr-4.2.1-dev/include
--with-mpfr-lib=/<<NIX>>/mpfr-4.2.1/lib --with-mpc=/<<NIX>>/libmpc-1.3.1
--with-native-system-header-dir=/<<NIX>>/glibc-2.39-31-dev/include
--with-build-sysroot=/
--with-gxx-include-dir=/<<NIX>>/gcc-15.0.0/include/c++/15.0.0/
--program-prefix= --enable-lto --disable-libstdcxx-pch
--without-included-gettext --with-system-zlib --enable-checking=release
--enable-static --enable-languages=c,c++ --disable-multilib --enable-plugin
--disable-libcc1 --with-isl=/<<NIX>>/isl-0.20 --disable-bootstrap
--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu
--target=x86_64-unknown-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 99999999 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/114933] [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here
  2024-05-03  8:54 [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here slyfox at gcc dot gnu.org
@ 2024-05-03  9:05 ` slyfox at gcc dot gnu.org
  2024-05-03  9:07 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: slyfox at gcc dot gnu.org @ 2024-05-03  9:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114933

Sergei Trofimovich <slyfox at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lh_mouse at 126 dot com
            Version|14.0                        |15.0

--- Comment #1 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
The original trigger code resides at
https://github.com/lhmouse/mcfgthread/blob/9f3c73a3651bf0cf94eef9681c5ba191d66b198b/mcfgthread/fwd.h#L131

/cc LIU Hao in case it's a new c++20 restriction and mcfgthread would need to
adapt.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/114933] [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here
  2024-05-03  8:54 [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here slyfox at gcc dot gnu.org
  2024-05-03  9:05 ` [Bug c++/114933] " slyfox at gcc dot gnu.org
@ 2024-05-03  9:07 ` pinskia at gcc dot gnu.org
  2024-05-03  9:09 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-03  9:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114933

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
r15-84-g79420dd3441458

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/114933] [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here
  2024-05-03  8:54 [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here slyfox at gcc dot gnu.org
  2024-05-03  9:05 ` [Bug c++/114933] " slyfox at gcc dot gnu.org
  2024-05-03  9:07 ` pinskia at gcc dot gnu.org
@ 2024-05-03  9:09 ` pinskia at gcc dot gnu.org
  2024-05-03  9:10 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-03  9:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114933

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Sergei Trofimovich from comment #1)
> /cc LIU Hao in case it's a new c++20 restriction and mcfgthread would need
> to adapt.

Looks like it is one:
https://cplusplus.github.io/CWG/issues/2443.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/114933] [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here
  2024-05-03  8:54 [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here slyfox at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-05-03  9:09 ` pinskia at gcc dot gnu.org
@ 2024-05-03  9:10 ` pinskia at gcc dot gnu.org
  2024-05-03  9:12 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-03  9:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114933

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2615r1.html

`For consistency extern "C" is given the same restrictions when used directly.`

So yes.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/114933] [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here
  2024-05-03  8:54 [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here slyfox at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-05-03  9:10 ` pinskia at gcc dot gnu.org
@ 2024-05-03  9:12 ` pinskia at gcc dot gnu.org
  2024-05-03  9:14 ` lh_mouse at 126 dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-03  9:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114933

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The easy fix is to do:
    extern "C++" {  template<bool> struct __MCF_static_assert; }
    extern "C++" { template<> struct __MCF_static_assert<true> { }; }

Note from the commit message:
    However there are also a couple of changes made to linkage specifiers
    ('extern "C"'); I've applied these as since C++20, to line up with when
    modules were actually introduced.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/114933] [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here
  2024-05-03  8:54 [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here slyfox at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-05-03  9:12 ` pinskia at gcc dot gnu.org
@ 2024-05-03  9:14 ` lh_mouse at 126 dot com
  2024-05-03  9:17 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: lh_mouse at 126 dot com @ 2024-05-03  9:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114933

--- Comment #6 from LIU Hao <lh_mouse at 126 dot com> ---
ISO/IEC WG21 N4917
> 13.9.4 Explicit specialization [temp.expl.spec]
> 2 An explicit specialization shall not use a storage-class-specifier (9.2.2) other than thread_local.

This paragraph is new in N4658 and was not in N4917. Better to avoid it by
moving the specialization into an extern "C++" block. Thanks for the report.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/114933] [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here
  2024-05-03  8:54 [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here slyfox at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-05-03  9:14 ` lh_mouse at 126 dot com
@ 2024-05-03  9:17 ` pinskia at gcc dot gnu.org
  2024-05-03  9:50 ` lh_mouse at 126 dot com
  2024-05-03 20:49 ` slyfox at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-03  9:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114933

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to LIU Hao from comment #6)
> This paragraph is new in N4658 and was not in N4917. Better to avoid it by
> moving the specialization into an extern "C++" block. Thanks for the report.

Right that is because of p2615r1 which is consider a DR due to cwg 2443:
https://cplusplus.github.io/CWG/issues/2443.html and we only applied to back to
C++20 (due to it only needing for modules).

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/114933] [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here
  2024-05-03  8:54 [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here slyfox at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-05-03  9:17 ` pinskia at gcc dot gnu.org
@ 2024-05-03  9:50 ` lh_mouse at 126 dot com
  2024-05-03 20:49 ` slyfox at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: lh_mouse at 126 dot com @ 2024-05-03  9:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114933

--- Comment #8 from LIU Hao <lh_mouse at 126 dot com> ---
Fixed in this commit:
https://github.com/lhmouse/mcfgthread/commit/86ea295e41523183e7680c03cab35e6eb74c4857

It has actually been disallowed since C++98 (N1804) but as part of a different
paragraph.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/114933] [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here
  2024-05-03  8:54 [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here slyfox at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-05-03  9:50 ` lh_mouse at 126 dot com
@ 2024-05-03 20:49 ` slyfox at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: slyfox at gcc dot gnu.org @ 2024-05-03 20:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114933

--- Comment #9 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
The mcfgthread change fixed the full gcc build for me. Thank you!

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-05-03 20:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-03  8:54 [Bug c++/114933] New: [15 Regression] mcfgthread-1.6.1 typecheck failure: error: explicit specializations are not permitted here slyfox at gcc dot gnu.org
2024-05-03  9:05 ` [Bug c++/114933] " slyfox at gcc dot gnu.org
2024-05-03  9:07 ` pinskia at gcc dot gnu.org
2024-05-03  9:09 ` pinskia at gcc dot gnu.org
2024-05-03  9:10 ` pinskia at gcc dot gnu.org
2024-05-03  9:12 ` pinskia at gcc dot gnu.org
2024-05-03  9:14 ` lh_mouse at 126 dot com
2024-05-03  9:17 ` pinskia at gcc dot gnu.org
2024-05-03  9:50 ` lh_mouse at 126 dot com
2024-05-03 20:49 ` slyfox at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).