public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-45011-4-C21lCr0YP0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-45011-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45011

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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 ‘function<C>’ for ‘void function(int)’ does
not match any template declaration
 template<> void function<C>(int parameter) {
                 ^
45011.cc: In function ‘int main()’:
45011.cc:13:16: error: no matching function for call to ‘function(int)’
   function<C>(0);
                ^
45011.cc:13:16: note: candidate is:
45011.cc:6:27: note: template<class T> void function(typename T::Private)
 template<typename T> void function(typename T::Private);
                           ^
45011.cc: In function ‘void function(typename T::Private) [with T = C; typename
T::Private = int]’:
45011.cc:3:15: error: ‘typedef int C::Private’ is private
   typedef int Private;
               ^
45011.cc:6:27: error: within this context
 template<typename T> 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 ‘function<C>’ for ‘void function(int)’ does
not match any template declaration
 template<> void function<C>(int parameter) {
                 ^


And the error is similar today:

45011.cc:9:17: error: template-id 'function<C>' for 'void function(int)' does
not match any template declaration
    9 | template<> void function<C>(int parameter) {
      |                 ^~~~~~~~~~~
45011.cc:6:27: note: candidate is: 'template<class T> void function(typename
T::Private)'
    6 | template<typename T> void function(typename T::Private);
      |                           ^~~~~~~~

       reply	other threads:[~2020-03-12 10:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-45011-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 10:45 ` redi at gcc dot gnu.org [this message]
2010-07-20 21:51 [Bug c++/45011] New: " eisenstatdavid+gcc at gmail dot com
2010-07-20 21:54 ` [Bug c++/45011] " pinskia at gcc dot gnu dot org
2010-07-24 20:21 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-45011-4-C21lCr0YP0@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).