public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35989]  New: code rejected in template specialization (4.2 did accept)
@ 2008-04-20 16:36 debian-gcc at lists dot debian dot org
  2008-04-20 16:36 ` [Bug c++/35989] " debian-gcc at lists dot debian dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2008-04-20 16:36 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 998 bytes --]

[forwarded from http://bugs.debian.org/470850]

code is rejected by 4.3.1 20080420, accepted by 4.2.3

  The following code has three specializations of a template.
The third one compiles with g++-4.2 but gives an error with g++-4.3 :

vdanjean@cayuga:/tmp/toto$ g++-4.3 -Wall -c test.cpp 
test.cpp:30: error: template parameters not used in partial specialization:
test.cpp:30: error:         ‘T’
test.cpp:30: error:         ‘A’
vdanjean@cayuga:/tmp/toto$

It seems to me that my code is correct and g++-4.3 wrong: I really use T
and A in the partial specialization.


-- 
           Summary: code rejected in template specialization (4.2 did
                    accept)
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35989


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

* [Bug c++/35989] code rejected in template specialization (4.2 did accept)
  2008-04-20 16:36 [Bug c++/35989] New: code rejected in template specialization (4.2 did accept) debian-gcc at lists dot debian dot org
@ 2008-04-20 16:36 ` debian-gcc at lists dot debian dot org
  2008-04-20 17:32 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2008-04-20 16:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from debian-gcc at lists dot debian dot org  2008-04-20 16:36 -------
Created an attachment (id=15500)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15500&action=view)
test case


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35989


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

* [Bug c++/35989] code rejected in template specialization (4.2 did accept)
  2008-04-20 16:36 [Bug c++/35989] New: code rejected in template specialization (4.2 did accept) debian-gcc at lists dot debian dot org
  2008-04-20 16:36 ` [Bug c++/35989] " debian-gcc at lists dot debian dot org
@ 2008-04-20 17:32 ` rguenth at gcc dot gnu dot org
  2009-07-23 17:34 ` da_cra_hunt at yahoo dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-20 17:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-04-20 17:31 -------
EDG agrees with gcc:

/tmp/test.cpp(29): warning #885: template parameter "T" is not used in or
cannot be deduced from the template argument list of class template
"remote_trait<std::vector<_Tp, _Alloc>::iterator>"
  template<class T, class A>
                 ^

/tmp/test.cpp(29): warning #885: template parameter "A" is not used in or
cannot be deduced from the template argument list of class template
"remote_trait<std::vector<_Tp, _Alloc>::iterator>"
  template<class T, class A>
                          ^

which means that from an std::vector<T, A>::iterator type T and A cannot
be deduced.  Which in the end means that this specialization is never
going to be selected.  Whether this is rightfully diagnosed as error by
gcc I don't know.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35989


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

* [Bug c++/35989] code rejected in template specialization (4.2 did accept)
  2008-04-20 16:36 [Bug c++/35989] New: code rejected in template specialization (4.2 did accept) debian-gcc at lists dot debian dot org
  2008-04-20 16:36 ` [Bug c++/35989] " debian-gcc at lists dot debian dot org
  2008-04-20 17:32 ` rguenth at gcc dot gnu dot org
@ 2009-07-23 17:34 ` da_cra_hunt at yahoo dot com
  2009-07-24 10:12 ` jwakely dot gcc at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: da_cra_hunt at yahoo dot com @ 2009-07-23 17:34 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 718 bytes --]



------- Comment #3 from da_cra_hunt at yahoo dot com  2009-07-23 17:34 -------
Simple case :


template<typename C> struct A {};
template<typename C> struct B { struct Inner {}; };

template<typename K>
struct A<typename B<K>::Inner> {};


4.1.2/VS2005 compile quietly. 4.3.2 (g++ -c test.cpp) gives :

kk.cpp:5: error: template parameters not used in partial specialization:
kk.cpp:5: error:         ‘K’


-- 

da_cra_hunt at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |da_cra_hunt at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35989


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

* [Bug c++/35989] code rejected in template specialization (4.2 did accept)
  2008-04-20 16:36 [Bug c++/35989] New: code rejected in template specialization (4.2 did accept) debian-gcc at lists dot debian dot org
                   ` (2 preceding siblings ...)
  2009-07-23 17:34 ` da_cra_hunt at yahoo dot com
@ 2009-07-24 10:12 ` jwakely dot gcc at gmail dot com
  2009-07-24 10:29 ` jwakely dot gcc at gmail dot com
  2009-07-24 10:42 ` paolo dot carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jwakely dot gcc at gmail dot com @ 2009-07-24 10:12 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 596 bytes --]



------- Comment #4 from jwakely dot gcc at gmail dot com  2009-07-24 10:12 -------
(In reply to comment #3)
> Simple case :
> 
> 
> template<typename C> struct A {};
> template<typename C> struct B { struct Inner {}; };
> 
> template<typename K>
> struct A<typename B<K>::Inner> {};
> 
> 
> 4.1.2/VS2005 compile quietly. 4.3.2 (g++ -c test.cpp) gives :
> 
> kk.cpp:5: error: template parameters not used in partial specialization:
> kk.cpp:5: error:         ‘K’
> 

I think this is invalid because K is used in a non-deduced context


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35989


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

* [Bug c++/35989] code rejected in template specialization (4.2 did accept)
  2008-04-20 16:36 [Bug c++/35989] New: code rejected in template specialization (4.2 did accept) debian-gcc at lists dot debian dot org
                   ` (3 preceding siblings ...)
  2009-07-24 10:12 ` jwakely dot gcc at gmail dot com
@ 2009-07-24 10:29 ` jwakely dot gcc at gmail dot com
  2009-07-24 10:42 ` paolo dot carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jwakely dot gcc at gmail dot com @ 2009-07-24 10:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jwakely dot gcc at gmail dot com  2009-07-24 10:29 -------
(In reply to comment #4)
> I think this is invalid because K is used in a non-deduced context

Which is the same problem as with the original testcase - this is not a bug in
gcc.

According to 14.5.4.1 [temp.class.spec.match] paragraph 2 the template
arguments of the partial specialisation must be deduced, but in the testcases
they appear in non-deduced contexts as defined by 14.8.2.4 [temp.deduct]
paragraph 4.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35989


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

* [Bug c++/35989] code rejected in template specialization (4.2 did accept)
  2008-04-20 16:36 [Bug c++/35989] New: code rejected in template specialization (4.2 did accept) debian-gcc at lists dot debian dot org
                   ` (4 preceding siblings ...)
  2009-07-24 10:29 ` jwakely dot gcc at gmail dot com
@ 2009-07-24 10:42 ` paolo dot carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-07-24 10:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from paolo dot carlini at oracle dot com  2009-07-24 10:42 -------
Closing...


-- 

paolo dot carlini at oracle dot com changed:

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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35989


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

end of thread, other threads:[~2009-07-24 10:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-20 16:36 [Bug c++/35989] New: code rejected in template specialization (4.2 did accept) debian-gcc at lists dot debian dot org
2008-04-20 16:36 ` [Bug c++/35989] " debian-gcc at lists dot debian dot org
2008-04-20 17:32 ` rguenth at gcc dot gnu dot org
2009-07-23 17:34 ` da_cra_hunt at yahoo dot com
2009-07-24 10:12 ` jwakely dot gcc at gmail dot com
2009-07-24 10:29 ` jwakely dot gcc at gmail dot com
2009-07-24 10:42 ` paolo dot carlini at oracle dot com

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