public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104066] New: "extern constinit long (* const syscall_reexported) (long, ...);" doesn't compile: gcc thinks "constinit" applies to return value, not to function pointer itself
@ 2022-01-17 12:08 safinaskar at mail dot ru
  2022-01-20  5:26 ` [Bug c++/104066] "extern constinit long (* const syscall_reexported) (long, ...); " " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: safinaskar at mail dot ru @ 2022-01-17 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104066
           Summary: "extern constinit long (* const syscall_reexported)
                    (long, ...);" doesn't compile: gcc thinks "constinit"
                    applies to return value, not to function pointer
                    itself
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: safinaskar at mail dot ru
  Target Milestone: ---

Consider this code:

extern constinit long (* const syscall_reexported) (long, ...);

(Godbolt: https://godbolt.org/z/de7W55rTo )

clang 13 happily compiles this code. gcc 11.2 rejects this code with message:

<source>:1:8: error: 'constinit' on function return type is not allowed
    1 | extern constinit long (* const syscall_reexported) (long, ...);
      |        ^~~~~~~~~

I. e. gcc thinks that "constinit" applies to return value, not to function
pointer itself

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

end of thread, other threads:[~2022-11-18  0:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 12:08 [Bug c++/104066] New: "extern constinit long (* const syscall_reexported) (long, ...);" doesn't compile: gcc thinks "constinit" applies to return value, not to function pointer itself safinaskar at mail dot ru
2022-01-20  5:26 ` [Bug c++/104066] "extern constinit long (* const syscall_reexported) (long, ...); " " pinskia at gcc dot gnu.org
2022-11-15 21:26 ` [Bug c++/104066] "extern constinit long (* const syscall_reexported) (long, ...);" " pinskia at gcc dot gnu.org
2022-11-15 21:38 ` [Bug c++/104066] "constinit extern long (*const f) ();" " mpolacek at gcc dot gnu.org
2022-11-18  0:17 ` cvs-commit at gcc dot gnu.org
2022-11-18  0:43 ` cvs-commit at gcc dot gnu.org
2022-11-18  0:45 ` cvs-commit at gcc dot gnu.org
2022-11-18  0:47 ` cvs-commit at gcc dot gnu.org
2022-11-18  0:48 ` mpolacek at gcc dot gnu.org
2022-11-18  0:53 ` pinskia 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).