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#0IT>7!E9&5F('5N<VEG;F5D(&EN= ES:7IE7W0[#0H-"G1E;7!L871E/ ET
M>7!E;F%M90E4#0H)"2P)<VEZ95]T"0E., T*"0DL"7-I>F5?= D)3C$-" D)
M+ ES:7IE7W0)"4XR#0H)"2P)='EP96YA;64)32 ](%1;3C  *B!.,2 J($XR
M73X-"G-T<G5C="!A<G)A>5]I;7!L#0I[#0H-" E4(&U?9&%T83L-"GT[#0H-
M"G1E;7!L871E/ ET>7!E;F%M90E4#0H)"2P)<VEZ95]T"0E., T*"0DL"7-I
M>F5?= D)3C$-" D)+ ES:7IE7W0)"4XR#0H)"3X-"G-T<G5C="!!<G)A>0T*
M>PT*"6%R<F%Y7VEM<&P\5"P 3C L($XQ+"!.,CX);5]A<G)A>3L-"GT[#0H-
M"FEN="!M86EN*"D-"GL-" ET>7!E9&5F"4%R<F%Y/&EN="P ,3 L(#$L(#$^
M"6EN=%\Q,%]A<G)A>5]T.PT*#0H):6YT7S$P7V%R<F%Y7W0)87([#0H-" EF
M;W(H<VEZ95]T(&D /2 P.R!I(#P <VEZ96]F*&%R+FU?87)R87DN;5]D871A
M*2 O('-I>F5O9BAA<BYM7V%R<F%Y+FU?9&%T85LP72D[("LK:2D-" E[#0H)
M"6%R+FU?87)R87DN;5]D871A6VE=(#T :3L-" E]#0H-" ER971U<FX ,#L-
$"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