From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0B3883858419; Sun, 12 Dec 2021 18:51:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B3883858419 From: "turtlefight at ymail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103672] New: using with template class> causes internal compiler error Date: Sun, 12 Dec 2021 18:51:49 +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: 11.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: turtlefight at ymail 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, 12 Dec 2021 18:51:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103672 Bug ID: 103672 Summary: using with template class> causes internal compiler error Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: turtlefight at ymail dot com Target Milestone: --- The following example results in an internal compiler error. It does compile fine with clang and msvc. Example Code: #include #include template struct unique { auto operator()(auto&&... args) { return std::make_unique(std::forward(args)...); } }; template class T, class... Args> using deduced_type =3D decltype(T{std::declval()...}); template class F, template class T, class... Args> auto make(Args&&... args) { return F>{}(std::forward(args)...); } template struct Foo { Foo(A,B) {} }; int main(){ auto foo_unique =3D make(1, 2); } Full Error Message: : In instantiation of 'auto make(Args&& ...) [with F =3D unique; T = =3D Foo; Args =3D {int, int}]': :24:40: required from here :16:41: internal compiler error: in tsubst, at cp/pt.c:15632 16 | return F>{}(std::forward(args)..= .); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~ 0x21004e9 internal_error(char const*, ...) ???:0 0x7e96eb fancy_abort(char const*, int, char const*) ???:0 0xa5fde7 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xa5d3af tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xa89b76 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0xa5d954 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xa5eb8d tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xa63a47 instantiate_decl(tree_node*, bool, bool) ???:0 0x904ebe maybe_instantiate_decl(tree_node*) ???:0 0x906980 mark_used(tree_node*, int) ???:0 0x819197 build_new_function_call(tree_node*, vec**, int) ???:0 0xaca89c finish_call_expr(tree_node*, vec**, b= ool, bool, int) ???:0 0xa29b8d c_parse_file() ???:0 0xbb6bb2 c_common_parse_file() ???:0 Godbolt Example: https://godbolt.org/z/rd4PdYrq8 What's interesting is that the code compiles without problems if a using declaration is not used, e.g.: template class F, template class T, class... Args> auto make(Args&&... args) { return F()...})>{}(std::forward(args)...); } Godbolt Example: https://godbolt.org/z/Pd3Mjs8rG=