[cfe-dev] Adding access to array size expressions in ConstantArrayType.

Enea Zaffanella zaffanella at cs.unipr.it
Tue Jun 30 12:52:54 PDT 2009


While at it, we found a transient bug in revision 74387
which is due to a double free of an Expr pointer.

The testcase showing the bug, which has been extracted from 
test/SemaTemplate/temp_class_spec_neg.cpp, is as follows:

============
template< int X, int (*array_ptr)[X] > class A2 {};
int array[5];
template< int X > class A2<X,&array> { };
============

We report it because, as said above, it is a transient bug, showing from 
  time to time. (We haven't checked if it has been already corrected in 
more recent revision.)

# clang-cc bug.cpp
bug.cpp:3:30: error: non-type template argument specializes a template 
parameter
       with dependent type 'int (*)[X]'
template< int X > class A2<X,&array> { };
                              ^~~~~~
bug.cpp:1:24: note: template parameter is declared here
template< int X, int (*array_ptr)[X] > class A2 {};
                        ^
0   clang-cc        0x0000000000e49b3f
1   clang-cc        0x0000000000e49f29
2   libpthread.so.0 0x0000003731c0ed30
3   clang-cc        0x0000000000761fab
4   clang-cc        0x00000000006f9bad
5   clang-cc        0x000000000042a3e5
6   clang-cc        0x000000000042dd8a main + 5194
7   libc.so.6       0x000000373101e32a __libc_start_main + 250
8   clang-cc        0x0000000000422d79
Stack dump:
0.	Program arguments: clang-cc bug.cpp
Segmentation fault


Cheers,
Enea Zaffanella



More information about the cfe-dev mailing list