www.digitalmars.com         C & C++   DMDScript  

c++ - Bug: mistakes compile-time multiplication in template param list for VLA

reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
Compiling STLSoft's static_array classes gives

    H:\STLSoft\Identities\STLSoft\stlsoft\stlsoft_static_array.h(730) 
: Error: variable length arrays are only for function prototypes and 
autos

Essentially, the class template is declared like this

template<   typename T
        ,   size_t N0
        ,   size_t N1
        ,   size_t N2
        ,   size_t N3
        ,   typename P   =   do_construction<T>
        ,   typename M   =   T[N0 * N1 * N2 * N3]
        >
class static_array_4d
{

    . . .

    M   m_data;    // <= This is the line (730) that causes the 
problem
};


I've tried boiling it down, but it eludes me. I've included a test 
file incorporates the same structure, but fails to elicit the error

It'd be great if this can be found and fixed for 8.44, as I suspect 
STLSoft 1.8.4 will be releasable at the same time.

Cheers

Matthew


begin 666 vla_bug.cpp









M;W(H<VEZ95]T(&D /2 P.R!I(#P <VEZ96]F*&%R+FU?87)R87DN;5]D871A

M"6%R+FU?87)R87DN;5]D871A6VE=(#T
$"GT-" ``
`
end
Apr 26 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message
news:d4n73h$6k9$1 digitaldaemon.com...
 I've tried boiling it down, but it eludes me. I've included a test
 file incorporates the same structure, but fails to elicit the error
I'm afraid that a test case that doesn't produce the error is not terribly useful.
May 17 2005
parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
"Walter" <newshound digitalmars.com> wrote in message 
news:d6ejip$1e4j$1 digitaldaemon.com...
 "Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message
 news:d4n73h$6k9$1 digitaldaemon.com...
 I've tried boiling it down, but it eludes me. I've included a 
 test
 file incorporates the same structure, but fails to elicit the 
 error
I'm afraid that a test case that doesn't produce the error is not terribly useful.
:-)
May 17 2005