From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A063C3858034; Sun, 20 Jun 2021 14:52:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A063C3858034 From: "ensadc at mailnesia dot com" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyBjKysvMTAxMTQwXSBOZXc6IFttb2R1bGVzXSBubyBtYXRj?= =?UTF-8?B?aGluZyBmdW5jdGlvbiBmb3IgY2FsbCB0byDigJhvcGVyYXRvciBuZXcoc2l6?= =?UTF-8?B?ZXR5cGUsIHZvaWQqKeKAmQ==?= Date: Sun, 20 Jun 2021 14:52:26 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ensadc at mailnesia dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Sun, 20 Jun 2021 14:52:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101140 Bug ID: 101140 Summary: [modules] no matching function for call to =E2=80=98ope= rator new(sizetype, void*)=E2=80=99 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ensadc at mailnesia dot com Target Milestone: --- $ cat new.hpp extern "C++" { void* operator new(__SIZE_TYPE__, void* p); } $ cat foo.cpp module; #include "new.hpp" export module foo; export template T* construct_at(T* p) { return ::new((void*)p) T(); } $ cat bar.cpp export module bar; import foo; void f(int* p) { construct_at(p); } $ g++ -std=3Dc++20 -fmodules-ts -c foo.cpp $ g++ -std=3Dc++20 -fmodules-ts -c bar.cpp In module foo, imported at bar.cpp:3: foo.cpp: In instantiation of =E2=80=98T* construct_at@foo(T*) [with T =3D i= nt]=E2=80=99: bar.cpp:6:17: required from here foo.cpp:7:12: error: no matching function for call to =E2=80=98operator new= (sizetype, void*)=E2=80=99 7 | return ::new((void*)p) T(); | ^~~~~~~~~~~~~~~~~~~ : note: candidate: =E2=80=98void* operator new(long unsigned int)= =E2=80=99 : note: candidate expects 1 argument, 2 provided : note: candidate: =E2=80=98void* operator new(long unsigned int, std::align_val_t)=E2=80=99 : note: no known conversion for argument 2 from =E2=80=98void*= =E2=80=99 to =E2=80=98std::align_val_t=E2=80=99 bar.cpp:1:8: warning: not writing module =E2=80=98bar=E2=80=99 due to errors 1 | export module bar; | ^~~~~~ =3D=3D=3D=3D The error disappears if "new.hpp" is included or imported in `bar.cpp`. I originally encountered this problem when using `std::construct_at` (defin= ed in``) in a module.=