This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3 PATCH] Fix syntax error in valarray_meta.h
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Subject: [v3 PATCH] Fix syntax error in valarray_meta.h
- From: Kriang Lerdsuwanakij <lerdsuwa at users dot sourceforge dot net>
- Date: Sat, 7 Jul 2001 03:37:58 -0700 (PDT)
Hi
I am working on some template template parameter issues in the C++ frontend
that is not standard compliant. I stumbled across some code in
valarray_meta.h that has been accepted by g++ but shouldn't be. The
unqualified id _Expr is used as template template argument inside the
class template _Expr. According to 14.6.1 (and some old comp.std.c++
discussions), _Expr without template arguments can only be interpreted as
the specialization _Expr<_Clos,_Tp>, not the class template _Expr.
The patch I proposed below replaces all problematic _Expr with the
qualified id std::_Expr which does the same thing but is standard compliant.
I will submit a patch to the C++ frontend (for the mainline) to
enforce the rule later after the problem in v3 has been fixed.
Bootstrapped and tested on i686-pc-linux-gnu with no regressions.
OK to install it in the mainline and maybe in 3.0 branch?
--Kriang
2001-07-07 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* include/bits/valarray_meta.h (_Expr::operator+): Use qualified id
for _Expr template template argument.
(_Expr::operator-): Likewise.
(_Expr::operator~): Likewise.
(_Expr::operator!): Likewise.
(_DEFINE_EXPR_UNARY_OPERATOR): Likewise.
diff -cprN gcc-main-save/libstdc++-v3/include/bits/valarray_meta.h gcc-main-new/libstdc++-v3/include/bits/valarray_meta.h
*** gcc-main-save/libstdc++-v3/include/bits/valarray_meta.h Mon Mar 5 04:34:01 2001
--- gcc-main-new/libstdc++-v3/include/bits/valarray_meta.h Fri Jul 6 00:20:53 2001
*************** namespace std
*** 655,670 ****
valarray<value_type> operator[] (const valarray<bool>&) const;
valarray<value_type> operator[] (const valarray<size_t>&) const;
! _Expr<_UnClos<_Unary_plus,_Expr,_Clos>, value_type>
operator+ () const;
! _Expr<_UnClos<negate,_Expr,_Clos>, value_type>
operator- () const;
! _Expr<_UnClos<_Bitwise_not,_Expr,_Clos>, value_type>
operator~ () const;
! _Expr<_UnClos<logical_not,_Expr,_Clos>, bool>
operator! () const;
size_t size () const;
--- 655,670 ----
valarray<value_type> operator[] (const valarray<bool>&) const;
valarray<value_type> operator[] (const valarray<size_t>&) const;
! _Expr<_UnClos<_Unary_plus,std::_Expr,_Clos>, value_type>
operator+ () const;
! _Expr<_UnClos<negate,std::_Expr,_Clos>, value_type>
operator- () const;
! _Expr<_UnClos<_Bitwise_not,std::_Expr,_Clos>, value_type>
operator~ () const;
! _Expr<_UnClos<logical_not,std::_Expr,_Clos>, bool>
operator! () const;
size_t size () const;
*************** namespace std
*** 769,784 ****
inline _Expr<_UnClos<logical_not,_Expr,_Dom>, bool>
_Expr<_Dom,_Tp>::operator! () const
{
! typedef _UnClos<logical_not,_Expr,_Dom> _Closure;
return _Expr<_Closure,_Tp> (_Closure(this->_M_closure));
}
#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \
template<class _Dom, typename _Tp> \
! inline _Expr<_UnClos<_Name,_Expr,_Dom>,_Tp> \
_Expr<_Dom,_Tp>::operator _Op () const \
{ \
! typedef _UnClos<_Name,_Expr,_Dom> _Closure; \
return _Expr<_Closure,_Tp> (_Closure (this->_M_closure)); \
}
--- 769,784 ----
inline _Expr<_UnClos<logical_not,_Expr,_Dom>, bool>
_Expr<_Dom,_Tp>::operator! () const
{
! typedef _UnClos<logical_not,std::_Expr,_Dom> _Closure;
return _Expr<_Closure,_Tp> (_Closure(this->_M_closure));
}
#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \
template<class _Dom, typename _Tp> \
! inline _Expr<_UnClos<_Name,std::_Expr,_Dom>,_Tp> \
_Expr<_Dom,_Tp>::operator _Op () const \
{ \
! typedef _UnClos<_Name,std::_Expr,_Dom> _Closure; \
return _Expr<_Closure,_Tp> (_Closure (this->_M_closure)); \
}