From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D36B23858407; Wed, 15 Sep 2021 11:37:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D36B23858407 From: "pilarlatiesa at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102341] [modules] "error: conflicting exporting declaration" for anything previously declared Date: Wed, 15 Sep 2021 11:37:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: pilarlatiesa at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 11:37:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102341 Pilar Latiesa changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pilarlatiesa at gmail dot = com --- Comment #4 from Pilar Latiesa --- In PR98885#C1 Nathan said that "an exported entity must be so-declared on i= ts first declaration". Would it be possible to forward-declare every exported entity and then `#include`ing all the headers? I mean something along the lines: $ cat borrar.h namespace Test { template class valarray {}; } $ cat borrar.cpp export module Test; namespace Test { export template class valarray; } #include "borrar.h" $ cat main.cpp import Test; int main() { Test::valarray v; return 0; } $ g++-11 -Wall -Wextra -fmodules-ts borrar.cpp main.cpp main.cpp: In function =E2=80=98int main()=E2=80=99: main.cpp:6:26: warning: unused variable =E2=80=98v=E2=80=99 [-Wunused-varia= ble] 6 | Test::valarray v; | ^ However, I don't think that this approach can be used to split the library = into several modules.=