From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E88C13938804; Thu, 12 Mar 2020 10:45:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E88C13938804 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1584009910; bh=atKeBatip+Xlolry8kxcVYC/B89uBzEJu9Z9sscHCDk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LYTrgDTSAXvTJd6fLxLvPGGMq9UCBTbBwtvkoywYkMcQAeDoACd+4VOGcz6jnCz2X fECICzjrmtvGrRwMY0Lb+8FCrsMjWFYFVBtmp6QnyREp1GU0lYyRi63NXt8+ba2/82 nsXfJPK6pafR/eNcKNYNmitmDaVGEYe9cco0V/Uc= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/45011] template function specialization: does not respect access specifier Date: Thu, 12 Mar 2020 10:45:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.6.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status resolution target_milestone Message-ID: In-Reply-To: References: 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, 12 Mar 2020 10:45:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D45011 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |4.8.0 --- Comment #3 from Jonathan Wakely --- Seems to have been fixed by r189640 for GCC 4.8 * pt.c (instantiate_decl): Don't recheck substitutions. At that revision we reject the testcase with this error: 45011.cc:9:17: error: template-id =E2=80=98function=E2=80=99 for =E2=80= =98void function(int)=E2=80=99 does not match any template declaration template<> void function(int parameter) { ^ 45011.cc: In function =E2=80=98int main()=E2=80=99: 45011.cc:13:16: error: no matching function for call to =E2=80=98function(i= nt)=E2=80=99 function(0); ^ 45011.cc:13:16: note: candidate is: 45011.cc:6:27: note: template void function(typename T::Private) template void function(typename T::Private); ^ 45011.cc: In function =E2=80=98void function(typename T::Private) [with T = =3D C; typename T::Private =3D int]=E2=80=99: 45011.cc:3:15: error: =E2=80=98typedef int C::Private=E2=80=99 is private typedef int Private; ^ 45011.cc:6:27: error: within this context template void function(typename T::Private); ^ The error changed at r195779 re PR c++/56208 (Some classic sfinae cases fail to work due to access problems) PR c++/56208 * pt.c (fn_type_unification): Discard any access checks from substituting explicit args. Since then we print: 45011.cc:9:17: error: template-id =E2=80=98function=E2=80=99 for =E2=80= =98void function(int)=E2=80=99 does not match any template declaration template<> void function(int parameter) { ^ And the error is similar today: 45011.cc:9:17: error: template-id 'function' for 'void function(int)' do= es not match any template declaration 9 | template<> void function(int parameter) { | ^~~~~~~~~~~ 45011.cc:6:27: note: candidate is: 'template void function(typename T::Private)' 6 | template void function(typename T::Private); | ^~~~~~~~=