X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=libstdc%2B%2B-v3%2Ftestsuite%2F26_numerics%2Fvalarray%2Fbinary_closure.cc;fp=libstdc%2B%2B-v3%2Ftestsuite%2F26_numerics%2Fvalarray%2Fbinary_closure.cc;h=7dbcfbd52287fc226f5c336721180d0b830af4f0;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=0000000000000000000000000000000000000000;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc b/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc new file mode 100644 index 00000000..7dbcfbd5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc @@ -0,0 +1,37 @@ +// 19990805 gdr +// +// XXX: to impove later. +// Origin: Andreas Amann +// CXXFLAGS: -g + +#include +#include + + +int main() +{ + std::valarray a(10), b(10), c(10), d(10); + + a = 1.2; + b = 3.1; + + c = 4.0; + + d = ( 2.0 * b + a ); // works + std::cout << "d[4] = " << d[4] << std::endl; + + d = (a * 2.0 + b ); // works + std::cout << "d[4] = " << d[4] << std::endl; + + d = (a + b * 2.0 ); // segfaults! + std::cout << "d[4] = " << d[4] << std::endl; + d = (a + 2.0* b ); + + std::cout << "d[4] = " << d[4] << std::endl; + d = (a + 2.0* b ); + std::cout << "d[4] = " << d[4] << std::endl; + d = (a + 2.0* b ); + + std::cout << "d[4] = " << d[4] << std::endl; + return 0; +}