From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7BAA83858288; Tue, 20 Jun 2023 15:57:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BAA83858288 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687276642; bh=UcmKldvoVBE+Yq2LL6akD+fTPEwzNTEWIsR8CHaY0+o=; h=From:To:Subject:Date:From; b=INJVve3e0songXfIB8OarIQ+cs5to5EWPNkKz44cYps2Z4tCm/W8dwgEexUplYexb OrBMxCgQax9btmSnoHr0HkgITVQiePYeR16sDCvqQA1JcsznxX3+dfo53CMdNfmMFa Jzv6bWNNWvV4cdcryZfvgCgSaMuxfxaVTOLGK2DM= From: "stlim0727 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110323] New: Code for explicit instantiation of template method of template class Date: Tue, 20 Jun 2023 15:57:22 +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.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: stlim0727 at gmail 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110323 Bug ID: 110323 Summary: Code for explicit instantiation of template method of template class Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: stlim0727 at gmail dot com Target Milestone: --- Code for explicit instantiation of a template method of a class is not generated with following code: $ cat > test.cpp #include constexpr int VAL =3D 1; struct foo { template void bar(typename std::conditional::type arg) { } }; template void foo::bar<1>(int arg); Code is not generated for g++11 and above versions: $ g++12 -S -o- -c test.cpp .file "test.cpp" .text .section .rodata .align 4 .type _ZL3VAL, @object .size _ZL3VAL, 4 _ZL3VAL: .long 1 .ident "GCC: (GNU) 12.1.1 20220628 (Red Hat 12.1.1-3)" .section .note.GNU-stack,"",@progbits However, the code is generated if I replace "B=3D=3DVAL" with "B=3D=3D1" or= if I use g++10 and below versions: $ g++8 -S -o- -c test.cpp .file "test.cpp" .text .section .rodata .align 4 .type _ZL3VAL, @object .size _ZL3VAL, 4 _ZL3VAL: .long 1 .section=20=20=20=20=20=20=20 .text._ZN3foo3barILi1EEEvNSt11conditionalIXeqT_L_ZL3VALEEifE4typeE,"axG",@p= rogbits,_ZN3foo3barILi1EEEvNSt11conditionalIXeqT_L_ZL3VALEEifE4typeE,comdat .align 2 .weak _ZN3foo3barILi1EEEvNSt11conditionalIXeqT_L_ZL3VALEEifE4typeE .type _ZN3foo3barILi1EEEvNSt11conditionalIXeqT_L_ZL3VALEEifE4type= E, @function _ZN3foo3barILi1EEEvNSt11conditionalIXeqT_L_ZL3VALEEifE4typeE: .LFB9: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movl %esi, -12(%rbp) nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size _ZN3foo3barILi1EEEvNSt11conditionalIXeqT_L_ZL3VALEEifE4type= E, .-_ZN3foo3barILi1EEEvNSt11conditionalIXeqT_L_ZL3VALEEifE4typeE .ident "GCC: (GNU) 8.5.0 20210514 (Red Hat 8.5.0-18)" .section .note.GNU-stack,"",@progbits=