http://llvm.org/bugs/show_bug.cgi?id=20946

            Bug ID: 20946
           Summary: Cannot multiply a valarray and a single element
                    slice_array
           Product: libc++
           Version: unspecified
          Hardware: Macintosh
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

#include <valarray>

int main(int argc, char *argv[]) {
       std::valarray<double> a(4, 10);
       std::valarray<double> b(4, 20);
       a *= b[std::slice(1,1,1)];
       return 0;
}

fails to compile, with error:
test.cpp:6:4: error: no viable overloaded '*='
       a *= b[std::slice(1,1,1)];
       ~ ^  ~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/valarray:871:15: note: candidate function not viable: no
known conversion from 'slice_array<value_type>' to 'const value_type'
     (aka 'const double') for 1st argument
   valarray& operator*= (const value_type& __x);
             ^
/usr/include/c++/v1/valarray:885:9: note: candidate template ignored: disabled
by 'enable_if' [with _Expr = std::__1::slice_array<double>]
       __is_val_expr<_Expr>::value,
       ^

Compiles with gcc 4.8 and 4.9

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to