public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63378] New: decltype and access control issues
@ 2014-09-26  7:28 roger.ferrer at bsc dot es
  2014-12-13 18:25 ` [Bug c++/63378] " ville.voutilainen at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: roger.ferrer at bsc dot es @ 2014-09-26  7:28 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4094 bytes --]

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

            Bug ID: 63378
           Summary: decltype and access control issues
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roger.ferrer at bsc dot es

Hi,

the following testcase fails to compile with g++ 4.9.1 and 5.0.0 (20140925).

-- test.cc
template <typename T1, typename S1>
struct B { };

template <typename T1>
struct A
{
    private:
    template <typename T2, typename S2>
        static B<T2, S2> bar();

    public:
    template <typename S2>
        auto foo1() -> decltype(bar<T1, S2>());
};

// (*)
template<>
template<>
auto A<int>::foo1<float>() -> B<int, float>;
-- end of test.cc

$ g++ --version
g++ (GCC) 5.0.0 20140925 (experimental)
$ g++ -c -std=c++11 -c test.cc
test.cc:18:6: error: template-id ‘foo1<float>’ for ‘B<int, float>
A<int>::foo1()’ does not match any template declaration
 auto A<int>::foo1<float>() -> B<int, float>;
      ^

but making 'A<T1>::bar' public or using '-fno-access-control' g++ accepts the
code OK.

Explicitly using a manually substituted decltype gives a clue of what is going
on

-- test.cc
// Declarations of B and A above

// (*)
template<>
template<>
auto A<int>::foo1<float>() -> decltype(A<int>::bar<int, float>());
-- end of test.cc

$ g++ -c -std=c++11 -c test.cc
test.cc:22:6: error: template-id ‘foo1<float>’ for ‘B<int, float>
A<int>::foo1()’ does not match any template declaration
 auto A<int>::foo1<float>() -> decltype(A<int>::bar<int, float>());
      ^
test.cc:9:26: error: ‘static B<T2, S2> A<T1>::bar() [with T2 = int; S2 = float;
T1 = int]’ is private
         static B<T2, S2> bar();
                          ^
test.cc:22:64: error: within this context
 auto A<int>::foo1<float>() -> decltype(A<int>::bar<int, float>());

Both clang-3.5 and icc 14.0.2 accept this code.

Kind regards,
>From gcc-bugs-return-462615-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Sep 26 07:29:41 2014
Return-Path: <gcc-bugs-return-462615-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8772 invoked by alias); 26 Sep 2014 07:29:40 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 8741 invoked by uid 48); 26 Sep 2014 07:29:31 -0000
From: "roger.ferrer at bsc dot es" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/63378] decltype and access control issues
Date: Fri, 26 Sep 2014 07:29:00 -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.9.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: roger.ferrer at bsc dot es
X-Bugzilla-Status: UNCONFIRMED
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: attachments.created
Message-ID: <bug-63378-4-o0t03R1g6v@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63378-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63378-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-09/txt/msg02449.txt.bz2
Content-length: 231

https://gcc.gnu.org/bugzilla/show_bug.cgi?idc378

--- Comment #1 from Roger Ferrer Ibanez <roger.ferrer at bsc dot es> ---
Created attachment 33578
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id3578&actioníit
Testcase


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/63378] decltype and access control issues
  2014-09-26  7:28 [Bug c++/63378] New: decltype and access control issues roger.ferrer at bsc dot es
@ 2014-12-13 18:25 ` ville.voutilainen at gmail dot com
  2023-12-08 20:29 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-13 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-13
                 CC|                            |ville.voutilainen at gmail dot com
     Ever confirmed|0                           |1
      Known to fail|                            |4.8.2, 4.9.1, 5.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/63378] decltype and access control issues
  2014-09-26  7:28 [Bug c++/63378] New: decltype and access control issues roger.ferrer at bsc dot es
  2014-12-13 18:25 ` [Bug c++/63378] " ville.voutilainen at gmail dot com
@ 2023-12-08 20:29 ` ppalka at gcc dot gnu.org
  2023-12-11 16:59 ` cvs-commit at gcc dot gnu.org
  2023-12-11 17:00 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-12-08 20:29 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This seems to be fixed for GCC 12+ by r12-4453-g79802c5dcc043a.  Before closing
the PR we should add this testcase to the testsuite.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/63378] decltype and access control issues
  2014-09-26  7:28 [Bug c++/63378] New: decltype and access control issues roger.ferrer at bsc dot es
  2014-12-13 18:25 ` [Bug c++/63378] " ville.voutilainen at gmail dot com
  2023-12-08 20:29 ` ppalka at gcc dot gnu.org
@ 2023-12-11 16:59 ` cvs-commit at gcc dot gnu.org
  2023-12-11 17:00 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-11 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:475b7f44c640c03f968d66dae389ea6165b4b5c2

commit r14-6422-g475b7f44c640c03f968d66dae389ea6165b4b5c2
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Dec 11 11:59:33 2023 -0500

    c++: add fixed testcase [PR63378]

    We accept this testcase since r12-4453-g79802c5dcc043a.

            PR c++/63378

    gcc/testsuite/ChangeLog:

            * g++.dg/template/fnspec3.C: New test.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/63378] decltype and access control issues
  2014-09-26  7:28 [Bug c++/63378] New: decltype and access control issues roger.ferrer at bsc dot es
                   ` (2 preceding siblings ...)
  2023-12-11 16:59 ` cvs-commit at gcc dot gnu.org
@ 2023-12-11 17:00 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-12-11 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |12.0
         Resolution|---                         |FIXED

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-11 17:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26  7:28 [Bug c++/63378] New: decltype and access control issues roger.ferrer at bsc dot es
2014-12-13 18:25 ` [Bug c++/63378] " ville.voutilainen at gmail dot com
2023-12-08 20:29 ` ppalka at gcc dot gnu.org
2023-12-11 16:59 ` cvs-commit at gcc dot gnu.org
2023-12-11 17:00 ` ppalka at gcc dot gnu.org

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).