public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98770] New: [modules] including certain stdlib headers in the global module fragment of different modules causes conflicting global module declarations
@ 2021-01-20 14:36 pilarlatiesa at gmail dot com
  2021-01-28 12:57 ` [Bug c++/98770] " cvs-commit at gcc dot gnu.org
  2021-01-28 12:58 ` nathan at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pilarlatiesa at gmail dot com @ 2021-01-20 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98770
           Summary: [modules] including certain stdlib headers in the
                    global module fragment of different modules causes
                    conflicting global module declarations
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pilarlatiesa at gmail dot com
  Target Milestone: ---

$ /home/pililatiesa/GCC-11/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/pililatiesa/GCC-11/bin/g++
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-master/configure --prefix=($HOME)/GCC-11
--enable-languages=c++ --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20210115 (experimental) (GCC)

$ cat Tensor.ixx

module;

#include <cstddef>
#include <iostream>

export module VF.Tensor;

namespace VF
{
export
template<std::size_t d, std::size_t r1>
struct TTensor
{
private:
  std::istream
  inline &Read(std::istream &is)
    { return is; }
};

export
template<std::size_t d>
using TVector = TTensor<d, 1u>;
} // VF


$ cat Mesh.ixx

module;

#include <cstddef>
#include <type_traits>

export module VF.Mesh;

import VF.Tensor;

namespace VF
{
template <std::size_t d>
class TPoint final : public TVector<d> {};
}


$ /home/pililatiesa/GCC-11/bin/g++ -fmodules-ts -x c++ -std=c++20 -I../ -I./
Tensor.ixx Mesh.ixx -o foo
In file included from
/home/pililatiesa/GCC-11/include/c++/11.0.0/bits/move.h:57,
                 from
/home/pililatiesa/GCC-11/include/c++/11.0.0/bits/nested_exception.h:40,
                 from
/home/pililatiesa/GCC-11/include/c++/11.0.0/exception:148,
                 from /home/pililatiesa/GCC-11/include/c++/11.0.0/ios:39,
                 from /home/pililatiesa/GCC-11/include/c++/11.0.0/ostream:38,
                 from /home/pililatiesa/GCC-11/include/c++/11.0.0/iostream:39,
                 from Tensor.ixx:5,
of module VF.Tensor, imported at Mesh.ixx:9:
/home/pililatiesa/GCC-11/include/c++/11.0.0/type_traits:634:31: error:
conflicting global module declaration ‘template<class ...> using __void_t =
void’
  634 |   template<typename...> using __void_t = void;
      |                               ^~~~~~~~
In file included from Mesh.ixx:5:
/home/pililatiesa/GCC-11/include/c++/11.0.0/type_traits:634:31: note: existing
declaration ‘template<class ...> using __void_t = void’
  634 |   template<typename...> using __void_t = void;
      |                               ^~~~~~~~
Mesh.ixx:14:29: note: during load of binding ‘VF::TVector@VF.Tensor’
   14 | class TPoint final : public TVector<d> {};
      |                             ^~~~~~~
Mesh.ixx:7:8: warning: not writing module ‘VF.Mesh’ due to errors
    7 | export module VF.Mesh;
      |

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

* [Bug c++/98770] [modules] including certain stdlib headers in the global module fragment of different modules causes conflicting global module declarations
  2021-01-20 14:36 [Bug c++/98770] New: [modules] including certain stdlib headers in the global module fragment of different modules causes conflicting global module declarations pilarlatiesa at gmail dot com
@ 2021-01-28 12:57 ` cvs-commit at gcc dot gnu.org
  2021-01-28 12:58 ` nathan at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-28 12:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathan Sidwell <nathan@gcc.gnu.org>:

https://gcc.gnu.org/g:af66f4f1b06f5e0c099dfced2fcf7b1b23fa53e7

commit r11-6954-gaf66f4f1b06f5e0c099dfced2fcf7b1b23fa53e7
Author: Nathan Sidwell <nathan@acm.org>
Date:   Thu Jan 28 04:48:33 2021 -0800

    c++: header unit template alias merging [PR 98770]

    Typedefs are streamed by streaming the underlying type, and then
    recreating the typedef.  But this breaks checking a duplicate is the
    same as the original when it is a template alias -- we end up checking
    a template alias (eg __void_t) against the underlying type (void).
    And those are not the same template alias.  This stops pretendig that
    the underlying type is the typedef for that checking and tells
    is_matching_decl 'you have a typedef', so it knows what to do.  (We do
    not want to recreate the typedef of the duplicate, because that whole
    set of nodes is going to go away.)

            PR c++/98770
            gcc/cp/
            * module.cc (trees_out::decl_value): Swap is_typedef & TYPE_NAME
            check order.
            (trees_in::decl_value): Do typedef frobbing only when installing
            a new typedef, adjust is_matching_decl call.  Swap is_typedef
            & TYPE_NAME check.
            (trees_in::is_matching_decl): Add is_typedef parm. Adjust variable
            names and deal with typedef checking.
            gcc/testsuite/
            * g++.dg/modules/pr98770_a.C: New.
            * g++.dg/modules/pr98770_b.C: New.

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

* [Bug c++/98770] [modules] including certain stdlib headers in the global module fragment of different modules causes conflicting global module declarations
  2021-01-20 14:36 [Bug c++/98770] New: [modules] including certain stdlib headers in the global module fragment of different modules causes conflicting global module declarations pilarlatiesa at gmail dot com
  2021-01-28 12:57 ` [Bug c++/98770] " cvs-commit at gcc dot gnu.org
@ 2021-01-28 12:58 ` nathan at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-01-28 12:58 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

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

--- Comment #2 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
af66f4f1b06 2021-01-28 | c++: header unit template alias merging [PR 98770]

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

end of thread, other threads:[~2021-01-28 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 14:36 [Bug c++/98770] New: [modules] including certain stdlib headers in the global module fragment of different modules causes conflicting global module declarations pilarlatiesa at gmail dot com
2021-01-28 12:57 ` [Bug c++/98770] " cvs-commit at gcc dot gnu.org
2021-01-28 12:58 ` nathan 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).