public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30836] New: template T[] doesn't catch T[5]
@ 2007-02-17 17:49 igodard at pacbell dot net
2007-02-17 19:11 ` [Bug c++/30836] " igodard at pacbell dot net
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: igodard at pacbell dot net @ 2007-02-17 17:49 UTC (permalink / raw)
To: gcc-bugs
The code:
#include <iostream>
template<typename T> struct foo {
static const int i = 0; };
template<>
template<typename U> struct foo<U[]> {
static const int i = 1; };
int main() {
int v[5];
std::cerr << foo<int[5]>::i << ":" << foo<int[]>::i << "\n";
return 0;
}
prints:
0:1
which shows that int[5] is not caught by a T[] specialization. This may be the
standard, but I'm not sure and submit it anyway in case it's a bug.
--
Summary: template T[] doesn't catch T[5]
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: igodard at pacbell dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30836
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/30836] template T[] doesn't catch T[5]
2007-02-17 17:49 [Bug c++/30836] New: template T[] doesn't catch T[5] igodard at pacbell dot net
@ 2007-02-17 19:11 ` igodard at pacbell dot net
2007-04-09 17:45 ` reichelt at gcc dot gnu dot org
2007-08-06 9:13 ` pcarlini at suse dot de
2 siblings, 0 replies; 4+ messages in thread
From: igodard at pacbell dot net @ 2007-02-17 19:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from igodard at pacbell dot net 2007-02-17 19:11 -------
p.s. I know I can catch it with:
template<>
template<Type T, size_t N>
struct foo<T[N]> {...}
but I though that plain "[]" would catch it too.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30836
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/30836] template T[] doesn't catch T[5]
2007-02-17 17:49 [Bug c++/30836] New: template T[] doesn't catch T[5] igodard at pacbell dot net
2007-02-17 19:11 ` [Bug c++/30836] " igodard at pacbell dot net
@ 2007-04-09 17:45 ` reichelt at gcc dot gnu dot org
2007-08-06 9:13 ` pcarlini at suse dot de
2 siblings, 0 replies; 4+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-04-09 17:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from reichelt at gcc dot gnu dot org 2007-04-09 18:45 -------
Just a side note: You should remove the "template<>" as it is invalid
and only accidentally accepted by GCC, see PR24314.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30836
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/30836] template T[] doesn't catch T[5]
2007-02-17 17:49 [Bug c++/30836] New: template T[] doesn't catch T[5] igodard at pacbell dot net
2007-02-17 19:11 ` [Bug c++/30836] " igodard at pacbell dot net
2007-04-09 17:45 ` reichelt at gcc dot gnu dot org
@ 2007-08-06 9:13 ` pcarlini at suse dot de
2 siblings, 0 replies; 4+ messages in thread
From: pcarlini at suse dot de @ 2007-08-06 9:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pcarlini at suse dot de 2007-08-06 09:13 -------
Yes, the standard is clear that array of unknown bound of T and array of N of T
are different types. And we are all implementing the is_array trait with 2
specializations (Vandevoorde and Josuttis included in their book).
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30836
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-08-06 9:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-17 17:49 [Bug c++/30836] New: template T[] doesn't catch T[5] igodard at pacbell dot net
2007-02-17 19:11 ` [Bug c++/30836] " igodard at pacbell dot net
2007-04-09 17:45 ` reichelt at gcc dot gnu dot org
2007-08-06 9:13 ` pcarlini at suse dot de
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).