This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/28414] return type of valarray's sqrt function isn't valarray



------- Comment #1 from gdr at integrable-solutions dot net  2006-07-17 23:57 -------
Subject: Re:   New: return type of valarray's sqrt function isn't valarray

"djg at cray dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| The return type of valarray's sqrt function isn't valarray, as specified in 
| 26.3.3.3 [lib.valarray.transcend], and what it does return doesn't convert to
| valarray in some cases. This causes the slice1.cpp example from the Josuttis 
| book examples to get a compile error:
| 
| http://www.josuttis.com/libbook/num/slice1.cpp.html

This is not a bug.  The implementation is conformant to the C++
standard, which says, 16.3.1/3

  Any function returning a valarray<T> is permitted to return an
  object of another type, provided all the const member functions of
  valarray<T> are also applicable to this type. This return type shall
  not add more than two levels of template nesting over the most
  deeply nested argument type.


Please read further the book by Josuttis for a note about this.

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28414


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]