public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bkoz@gnu.org
To: gcc-gnats@gcc.gnu.org
Cc: jason@redhat.com, mark@codesourcery.com
Subject: c++/3239: template specializations and namespace issues
Date: Mon, 18 Jun 2001 13:16:00 -0000	[thread overview]
Message-ID: <20010618200928.4094.qmail@sourceware.cygnus.com> (raw)

>Number:         3239
>Category:       c++
>Synopsis:       template specializations and namespace issues
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 18 13:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Benjamin Kosnik
>Release:        gcc-3.0, gcc CVS
>Organization:
>Environment:
x86/linux, all
>Description:
Try compiling the following legal code:


namespace std
{
  template <class _T1, class _T2>
  struct pair {
    typedef _T1 first_type;
    typedef _T2 second_type;

    _T1 first;
    _T2 second;
    //265.  std::pair::pair() effects overly restrictive
    pair() : first(), second() {}
    pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}

    template <class _U1, class _U2>
    pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
  };
}

bool global = false;

template<> class std::pair<int, int>
{
public:
  pair(const int&, const int&) { global = true; }
};

And you'll get:
%COMP.sh g++1.cc
g++1.cc:29: specializing `class std::pair<int, int>' in different namespace
g++1.cc:6:   from definition of `template<class _T1, class _T2> struct 
   std::pair'


A particular C++ conformance suite uses this idiom throughout the testsuite.

-benjamin
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2001-06-18 13:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-18 13:16 bkoz [this message]
2001-06-19  3:06 Alexandre Oliva
2002-04-26  4:01 nathan
2002-04-26  4:56 Jason Merrill

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=20010618200928.4094.qmail@sourceware.cygnus.com \
    --to=bkoz@gnu.org \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=mark@codesourcery.com \
    /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).