public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9865: [3.2/3.3/3.4 regression] Template matching for reference types
@ 2003-03-06 20:57 jason
  0 siblings, 0 replies; 4+ messages in thread
From: jason @ 2003-03-06 20:57 UTC (permalink / raw)
  To: dbeck, gcc-bugs, gcc-prs, jason, nathan

Synopsis: [3.2/3.3/3.4 regression] Template matching for reference types

Responsible-Changed-From-To: jason->nathan
Responsible-Changed-By: jason
Responsible-Changed-When: Thu Mar  6 20:57:50 2003
Responsible-Changed-Why:
    This was broken by your patch of a year ago for c++/2645 and DR 295.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9865


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

* Re: c++/9865: [3.2/3.3/3.4 regression] Template matching for reference types
@ 2003-03-27 14:04 nathan
  0 siblings, 0 replies; 4+ messages in thread
From: nathan @ 2003-03-27 14:04 UTC (permalink / raw)
  To: dbeck, gcc-bugs, gcc-prs, nathan

Synopsis: [3.2/3.3/3.4 regression] Template matching for reference types

State-Changed-From-To: analyzed->closed
State-Changed-By: nathan
State-Changed-When: Thu Mar 27 14:01:43 2003
State-Changed-Why:
    Not a bug. It is doing exactly what the standard says.
    
    template <typename T> struct Foo; //#1
    template <typename T> struct Foo<const T>; //#2
    Foo<short &> ;;// #1 or #2?
    14.5.4.1/2 says a partial specialization matches if the template arguments of the partial specialization can be deduced from the actual template argument list. So, can 'const T' deduce a T from 'short &'? One deduction is that T is 'short &', which leads to a const qualified reference type. [8.3.2]/1 says that that's ill-formed *except* when
    the cv qualifiers are introduced through the use of a typedef or of a template type argument, in which case they are ignored. So the partial specialization #2 is selected, rather than the primary template #1.
    
    That is PR 2645.
    DR295 was the similar case for function types, and I think it is bad for exactly the same reasons PR 9865 is giving a surprise.
    
    To avoid the surprise, you need another partial specialization
    template <typename T> struct foo<T &>;

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9865


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

* Re: c++/9865: [3.2/3.3/3.4 regression] Template matching for reference types
@ 2003-03-06 18:04 jason
  0 siblings, 0 replies; 4+ messages in thread
From: jason @ 2003-03-06 18:04 UTC (permalink / raw)
  To: dbeck, gcc-bugs, gcc-prs, jason, nobody

Synopsis: [3.2/3.3/3.4 regression] Template matching for reference types

Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-By: jason
Responsible-Changed-When: Thu Mar  6 18:04:41 2003
Responsible-Changed-Why:
    got it

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9865


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

* Re: c++/9865: [3.2/3.3/3.4 regression] Template matching for reference types
@ 2003-02-26 17:52 bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2003-02-26 17:52 UTC (permalink / raw)
  To: dbeck, gcc-bugs, gcc-prs, nobody

Old Synopsis: traits for const types have bad results
New Synopsis: [3.2/3.3/3.4 regression] Template matching for reference types

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Wed Feb 26 17:52:32 2003
State-Changed-Why:
    Confirmed. A shorter testcase is this:
    ----------------------------
    template <typename T> struct is_const {
        static const bool value = false;
    };
    
    template <typename T> struct is_const<const T> {
    };
    
    
    int main() {
      is_const<short &>::value;
    }
    -------------------------
    I don't think it should fail to compile, but it does since 
    3.2, the reason being that gcc decides to look into the
    const specialization of the template.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9865


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

end of thread, other threads:[~2003-03-27 14:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-06 20:57 c++/9865: [3.2/3.3/3.4 regression] Template matching for reference types jason
  -- strict thread matches above, loose matches on Subject: below --
2003-03-27 14:04 nathan
2003-03-06 18:04 jason
2003-02-26 17:52 bangerth

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