public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3239: template specializations and namespace issues
@ 2001-06-18 13:16 bkoz
0 siblings, 0 replies; 4+ messages in thread
From: bkoz @ 2001-06-18 13:16 UTC (permalink / raw)
To: gcc-gnats; +Cc: jason, mark
>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:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/3239: template specializations and namespace issues
@ 2002-04-26 4:56 Jason Merrill
0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2002-04-26 4:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/3239; it has been noted by GNATS.
From: Jason Merrill <jason@redhat.com>
To: nathan@gcc.gnu.org
Cc: bkoz@gnu.org, gcc-bugs@gcc.gnu.org, mark@codesourcery.com,
nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: c++/3239: template specializations and namespace issues
Date: Fri, 26 Apr 2002 12:55:55 +0100
To clarify, if the specialization had been previously declared in std, the
definition would be well-formed (and accepted by g++).
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/3239: template specializations and namespace issues
@ 2002-04-26 4:01 nathan
0 siblings, 0 replies; 4+ messages in thread
From: nathan @ 2002-04-26 4:01 UTC (permalink / raw)
To: bkoz, gcc-bugs, gcc-prs, jason, mark, nobody
Synopsis: template specializations and namespace issues
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Fri Apr 26 04:01:04 2002
State-Changed-Why:
not a bug, like gaby says, is should be inside
namespace std { ... };
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3239
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/3239: template specializations and namespace issues
@ 2001-06-19 3:06 Alexandre Oliva
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2001-06-19 3:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/3239; it has been noted by GNATS.
From: Alexandre Oliva <aoliva@redhat.com>
To: bkoz@gnu.org
Cc: gcc-gnats@gcc.gnu.org, jason@redhat.com, mark@codesourcery.com
Subject: Re: c++/3239: template specializations and namespace issues
Date: 19 Jun 2001 06:58:43 -0300
[temp.expl.spec]/2 says ``An explicit specialization shall be declared
in the namespace of which the template is a member [...]''
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-04-26 11:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-18 13:16 c++/3239: template specializations and namespace issues bkoz
2001-06-19 3:06 Alexandre Oliva
2002-04-26 4:01 nathan
2002-04-26 4:56 Jason Merrill
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).