public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/102345] New: [modules] Cannot define a module interface unit for anything in <new>
Date: Wed, 15 Sep 2021 11:21:00 +0000	[thread overview]
Message-ID: <bug-102345-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 102345
           Summary: [modules] Cannot define a module interface unit for
                    anything in <new>
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

Similar to PR 48396, the implicit declaration of std::align_val_t means you
can't include <new> in a module interface unit.

There are also apparently conflicts between the (correct according to the
standard) new/delete operators, and GCC's built-ins.


export module newdel;
#include <new>



new.cc:5:28: error: cannot define ‘enum class std::align_val_t’ in different
module
    5 |   enum class align_val_t : size_t;
      |                            ^~~~~~
<built-in>: note: declared here
new.cc:5: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccZNf6X0.out file, please attach this to
your bugreport.
tmp$ g++20 mod2.cc -fmodules-ts
In file included from mod2.cc:2:
/home/jwakely/gcc/12/include/c++/12.0.0/new:127:41: error: declaration 'void*
operator new(std::size_t)' conflicts with builtin
  127 |   __attribute__((__externally_visible__));
      |                                         ^
/home/jwakely/gcc/12/include/c++/12.0.0/new:129:41: error: declaration 'void*
operator new [](std::size_t)' conflicts with builtin
  129 |   __attribute__((__externally_visible__));
      |                                         ^
/home/jwakely/gcc/12/include/c++/12.0.0/new:131:41: error: declaration 'void
operator delete(void*)' conflicts with builtin
  131 |   __attribute__((__externally_visible__));
      |                                         ^
/home/jwakely/gcc/12/include/c++/12.0.0/new:133:41: error: declaration 'void
operator delete [](void*)' conflicts with builtin
  133 |   __attribute__((__externally_visible__));
      |                                         ^
/home/jwakely/gcc/12/include/c++/12.0.0/new:136:41: error: declaration 'void
operator delete(void*, std::size_t)' conflicts with builtin
  136 |   __attribute__((__externally_visible__));
      |                                         ^
/home/jwakely/gcc/12/include/c++/12.0.0/new:138:41: error: declaration 'void
operator delete [](void*, std::size_t)' conflicts with builtin
  138 |   __attribute__((__externally_visible__));
      |                                         ^
/home/jwakely/gcc/12/include/c++/12.0.0/new:150:73: error: declaration 'void*
operator new(std::size_t, std::align_val_t)' conflicts with builtin
  150 |   __attribute__((__externally_visible__, __alloc_size__ (1),
__malloc__));
      |                                                                        
^
/home/jwakely/gcc/12/include/c++/12.0.0/new:154:63: error: declaration 'void
operator delete(void*, std::align_val_t)' conflicts with builtin
  154 |   _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
      |                                                               ^
/home/jwakely/gcc/12/include/c++/12.0.0/new:158:73: error: declaration 'void*
operator new [](std::size_t, std::align_val_t)' conflicts with builtin
  158 |   __attribute__((__externally_visible__, __alloc_size__ (1),
__malloc__));
      |                                                                        
^
/home/jwakely/gcc/12/include/c++/12.0.0/new:162:63: error: declaration 'void
operator delete [](void*, std::align_val_t)' conflicts with builtin
  162 |   _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
      |                                                               ^
/home/jwakely/gcc/12/include/c++/12.0.0/new:167:63: error: declaration 'void
operator delete(void*, std::size_t, std::align_val_t)' conflicts with builtin
  167 |   _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
      |                                                               ^
/home/jwakely/gcc/12/include/c++/12.0.0/new:169:63: error: declaration 'void
operator delete [](void*, std::size_t, std::align_val_t)' conflicts with
builtin
  169 |   _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
      |                                                               ^
mod2.cc:1:8: warning: not writing module 'newdel' due to errors
    1 | export module newdel;
      |        ^~~~~~

             reply	other threads:[~2021-09-15 11:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15 11:21 redi at gcc dot gnu.org [this message]
2021-09-15 11:22 ` [Bug c++/102345] " redi at gcc dot gnu.org
2021-09-15 11:24 ` redi at gcc dot gnu.org
2021-09-15 11:24 ` redi at gcc dot gnu.org
2024-03-13 18:26 ` ppalka at gcc dot gnu.org
2024-05-25  0:32 ` cvs-commit at gcc dot gnu.org
2024-05-25  0:34 ` nshead at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-102345-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).