summaryrefslogtreecommitdiffstats
path: root/libcxx/include/valarray
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-04-02 08:05:23 +0000
committerEric Fiselier <eric@efcs.ca>2019-04-02 08:05:23 +0000
commit0657197588ffea508426de1e0c2afa65e76e24fa (patch)
treeea0b248815ce3257e80890880e821a3612524a50 /libcxx/include/valarray
parentb669fea42f5c2a5b203c3f0da2a6b04b90bfd5a7 (diff)
downloadbcm5719-llvm-0657197588ffea508426de1e0c2afa65e76e24fa.tar.gz
bcm5719-llvm-0657197588ffea508426de1e0c2afa65e76e24fa.zip
Fix a number of bugs in __val_expr's subset operator[].
The current definitions were entirely broken. They didn't call any existing constructor and the forgot to friend the expression types they were trying to construct. llvm-svn: 357453
Diffstat (limited to 'libcxx/include/valarray')
-rw-r--r--libcxx/include/valarray23
1 files changed, 19 insertions, 4 deletions
diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index c9ca08c618b..1c4875efad3 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -673,6 +673,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
size_t size() const {return __size_;}
+ template <class> friend class __val_expr;
template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
};
@@ -2221,6 +2222,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
size_t size() const {return __1d_.size();}
+ template <class> friend class __val_expr;
template <class> friend class valarray;
};
@@ -2591,6 +2593,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
size_t size() const {return __1d_.size();}
+ template <class> friend class __val_expr;
template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
};
@@ -2613,19 +2616,31 @@ public:
_LIBCPP_INLINE_VISIBILITY
__val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
- {return __val_expr<__slice_expr<_ValExpr> >(__expr_, __s);}
+ {
+ typedef __slice_expr<_ValExpr> _NewExpr;
+ return __val_expr< _NewExpr >(_NewExpr(__s, __expr_));
+ }
_LIBCPP_INLINE_VISIBILITY
__val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
- {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __gs.__1d_);}
+ {
+ typedef __indirect_expr<_ValExpr> _NewExpr;
+ return __val_expr<_NewExpr >(_NewExpr(__gs.__1d_, __expr_));
+ }
_LIBCPP_INLINE_VISIBILITY
__val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
- {return __val_expr<__mask_expr<_ValExpr> >(__expr_, __vb);}
+ {
+ typedef __mask_expr<_ValExpr> _NewExpr;
+ return __val_expr< _NewExpr >( _NewExpr(__vb, __expr_));
+ }
_LIBCPP_INLINE_VISIBILITY
__val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
- {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __vs);}
+ {
+ typedef __indirect_expr<_ValExpr> _NewExpr;
+ return __val_expr< _NewExpr >(_NewExpr(__vs, __expr_));
+ }
_LIBCPP_INLINE_VISIBILITY
__val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
OpenPOWER on IntegriCloud