c++: Support module language-decl semantics
authorNathan Sidwell <nathan@acm.org>
Mon, 9 May 2022 11:51:32 +0000 (04:51 -0700)
committerNathan Sidwell <nathan@acm.org>
Thu, 12 May 2022 10:44:59 +0000 (03:44 -0700)
commit78c8b0b980341f28de96da518a38bf85bbd24d98
tree217867ee60c1cb15c1567f28bf680885ec4ce7a0
parent3c9364f29e7e47eb9de33f2d8843d5b00284ceca
c++: Support module language-decl semantics

In modules purview, one can attach a declaration to the global module
(i.e. not the named module in whence the declaration appears), using a
language declaration:

  export module Foo;
  extern "C++" void *operator new (std::size_t);

This implements those semantics.

gcc/cp/
* parser.cc (cp_parser_linkage_specification): Implement
global module attachment semantics.
gcc/testsuite/
* g++.dg/modules/lang-3_a.C: New.
* g++.dg/modules/lang-3_b.C: New.
* g++.dg/modules/lang-3_c.C: New.
gcc/cp/parser.cc
gcc/testsuite/g++.dg/modules/lang-3_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/lang-3_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/lang-3_c.C [new file with mode: 0644]