Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-622

valarray operator requirements not consistent with standard

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 4.2.0
    • Fix Version/s: 4.2.1
    • Component/s: 26. Numerics
    • Labels:
      None
    • Severity:
      Incorrect Behavior

      Description

      26.3.2.6 p1 says

      Each of these operators may only be instantiated for a type T to which the indicated operator can be
      applied. Each of these operators performs the indicated operation on each of its elements and the corresponding
      element of the argument array. [for operators *=, /=, %=, +=, -=, ^=, &=, |=, <<= and >>=]

      The current implementation of the valarray member operators violate these requirements. Internally they use the transform algorithm with one of the function adapters [i.e. multiplies, divides]. So valarray<T>::operator+=() will use T::operator+() and T::operator=() when it should be using T::operator+=(). As a direct result of this, the 26.valarray.cassign test fails to compile on all platforms.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vitek Travis Vitek
                Reporter:
                vitek Travis Vitek
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: