From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 296483842400; Thu, 16 Jul 2020 00:06:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 296483842400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594857996; bh=a5hOJ9Cr7KGGvytTMNAz9uj7g2klU/V8RJ/g0ScEZ40=; h=From:To:Subject:Date:From; b=UKRolCTuJg9WgfI1se10i76+5Iu3wpW5p3Z6viD17OKmrgeHNFL8hjNrHw8axOnR2 cVlUfiEsQpZ/wbhBdFEGFPAYUUkwaf+aeBQ/bo3EMLwi9ZQssBDXiX9UoZtpwI4ud9 HGNI+pkkieUIer+OnjEjeq05bR8Y6TzT0KD75O+Q= From: "arthur.j.odwyer at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96213] New: GCC doesn't complain about ill-formed non-dependent template default argument Date: Thu, 16 Jul 2020 00:06:35 +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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: arthur.j.odwyer 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 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: Thu, 16 Jul 2020 00:06:36 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96213 Bug ID: 96213 Summary: GCC doesn't complain about ill-formed non-dependent template default argument Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: arthur.j.odwyer at gmail dot com Target Milestone: --- Possibly related (although these seem to complain about the opposite of what I'm complaining about): - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D12672 - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D58071 // https://godbolt.org/z/EYzxx9 template int g; template(0,1,2)> void h() { } int main() { h<1>(); } MSVC and Clang both reject template `h` as ill-formed, because `g(0,1,= 2)` is nonsense -- `g` is an `int` and thus cannot be called like a functi= on. GCC accepts template `h` as well-formed, and in fact will treat this as a SFINAE situation: template int g; template(42)> void h() {} // #1 template void h() {} // #2 int main() { h<>(); // unambiguously calls #2, because #1 has a deduction failu= re } My guess is that MSVC and Clang are closer to correct here.=