[Bug c++/30836] New: template T[] doesn't catch T[5]

igodard at pacbell dot net gcc-bugzilla@gcc.gnu.org
Sat Feb 17 17:49:00 GMT 2007


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



More information about the Gcc-bugs mailing list