From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 44678385DC26; Thu, 30 Apr 2020 18:10:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44678385DC26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588270207; bh=uFE7MpWSn/0lfcJNSeM9FIgJQlYkwnINBEfdRKoNP9I=; h=From:To:Subject:Date:From; b=s+jHrnhYe2Aebe6YB9ZVr2aRqWpWFr4dfzVExJ33VpBYIwu04GDFtIK6+YZcpPsbM W7CbILGsVC1GFMvSgjlN9FgFIJcf5EpcKWc1BXrdZR3oEasFigg2yCCp1CJRVKlaN6 1uTkxKnK05msVRlnw/91kKfpAjw3ycnnLCc+InXs= From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94894] New: Premature instantiation of conversion function template during overload resolution Date: Thu, 30 Apr 2020 18:10:07 +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: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka at gcc dot gnu.org 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, 30 Apr 2020 18:10:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94894 Bug ID: 94894 Summary: Premature instantiation of conversion function template during overload resolution Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ppalka at gcc dot gnu.org Target Milestone: --- The following testcase was reduced from a build failure with GCC 10 when compiling LLVM. When considering the overload candidate 'void f(int&)' for the overloaded c= all 'f(S{})', we try to build up a conversion sequence from 'S' to 'int&' that = goes through the conversion operator template with T=3Dint. In doing so we instantiate the conversion operator template, which triggers an instantiati= on of F::k which triggers a hard error. $ cat testcase.C template struct F { static_assert(B); }; struct S { template ::k> operator T(); }; void f(int&); void f(S); void foo() { f(S{}); } $ g++ testcase.C testcase.C: In instantiation of =E2=80=98struct F=E2=80=99: testcase.C:9:37: required by substitution of =E2=80=98template > S::operator T() [with T =3D int; int =3D ]=E2=80=99 testcase.C:18:6: required from here testcase.C:4:17: error: static assertion failed 4 | static_assert(B); | ^=