public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67605] New: Compilation errors creating std::pair using templated arguments
@ 2015-09-16 20:45 kplatz at utdallas dot edu
  2015-09-16 21:00 ` [Bug c++/67605] " glisse at gcc dot gnu.org
  2021-07-22 19:04 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: kplatz at utdallas dot edu @ 2015-09-16 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67605
           Summary: Compilation errors creating std::pair using templated
                    arguments
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kplatz at utdallas dot edu
  Target Milestone: ---

The following code compiles correctly on the GCC-4.8 series, but errors out on
GCC-4.9 and 5.X:

#include <algorithm>
#include <utility>

template<int K> class List;

template<int K>
class List  {
    template<int KK>
    class Node {
    public:
        static const int SPLIT;
        Node<KK>* next;            // Next pointer
        int keys[KK];       // Set of key/data pairs.

        Node() : next(nullptr) {
            std::fill(keys, keys + KK, 0); 
        }
    };

public:
    std::pair<Node<K>*, Node<K>*> scan();
};

template <int K>
std::pair<List<K>::Node<K>*, List<K>::Node<K>*> List<K>::scan( ) {
    return std::make_pair( nullptr, nullptr );
}

int main() {
    List<1> foo;

    auto bar = foo.scan();
}

The errors reported are:
[ken@sager ~]$ g++520 --std=c++11 urllist1.cpp 
urllist1.cpp:32:26: error: wrong number of template arguments (1, should be 2)
 std::pair<List<K>::Node<K>*, List<K>::Node<K>*> List<K>::scan( ) {
                          ^
In file included from /usr/local/include/c++/5.2.0/utility:70:0,
                 from /usr/local/include/c++/5.2.0/algorithm:60,
                 from urllist1.cpp:8:
/usr/local/include/c++/5.2.0/bits/stl_pair.h:96:12: note: provided for
‘template<class _T1, class _T2> struct std::pair’
     struct pair
            ^
urllist1.cpp:32:28: error: expected unqualified-id before ‘,’ token
 std::pair<List<K>::Node<K>*, List<K>::Node<K>*> List<K>::scan( ) {
>From gcc-bugs-return-497365-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Sep 16 20:56:19 2015
Return-Path: <gcc-bugs-return-497365-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 91678 invoked by alias); 16 Sep 2015 20:56:19 -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 91641 invoked by uid 48); 16 Sep 2015 20:56:15 -0000
From: "dje at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/67604] shrink-wrap doesn't allow multiple entries
Date: Wed, 16 Sep 2015 20:56:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dje at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: segher at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-67604-4-5NrYlC4Ien@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67604-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67604-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: 2015-09/txt/msg01343.txt.bz2
Content-length: 547

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

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-16
                 CC|                            |dje at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from David Edelsohn <dje at gcc dot gnu.org> ---
Confirmed.


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

* [Bug c++/67605] Compilation errors creating std::pair using templated arguments
  2015-09-16 20:45 [Bug c++/67605] New: Compilation errors creating std::pair using templated arguments kplatz at utdallas dot edu
@ 2015-09-16 21:00 ` glisse at gcc dot gnu.org
  2021-07-22 19:04 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-09-16 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
Spelling it "typename List<K>::template Node<K>*" helps. Note that clang
rejects the code as well.


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

* [Bug c++/67605] Compilation errors creating std::pair using templated arguments
  2015-09-16 20:45 [Bug c++/67605] New: Compilation errors creating std::pair using templated arguments kplatz at utdallas dot edu
  2015-09-16 21:00 ` [Bug c++/67605] " glisse at gcc dot gnu.org
@ 2021-07-22 19:04 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-22 19:04 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This:
std::pair<List<K>::Node<K>*, List<K>::Node<K>*>

Needs to be:
std::pair<typename List<K>::template Node<K>*, typename List<K>::template
Node<K>*>

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

end of thread, other threads:[~2021-07-22 19:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-16 20:45 [Bug c++/67605] New: Compilation errors creating std::pair using templated arguments kplatz at utdallas dot edu
2015-09-16 21:00 ` [Bug c++/67605] " glisse at gcc dot gnu.org
2021-07-22 19:04 ` pinskia 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).