[llvm-bugs] [Bug 34515] New: std::indirect_array::operator= gives wrong result.
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 6 21:14:58 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34515
Bug ID: 34515
Summary: std::indirect_array::operator= gives wrong result.
Product: libc++
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: pichet2000 at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
#include "iostream"
#include <valarray>
int main() {
int input[] = { 0, 1, 2, 3, 4, 5, 6 };
std::valarray<int> filled(input, 7);
size_t indexes[] = { 1, 3, 4, 6 };
std::valarray<size_t> index(indexes, 4);
size_t indexes2[] = { 1, 2, 3, 4 };
std::valarray<size_t> index2(indexes2, 4);
const std::indirect_array<int> result = filled[index];
const std::indirect_array<int> result2 = filled[index2];
result = result2;
std::valarray<int> temp(result);
for (int i = 0; i < temp.size(); i++)
std::cout << temp[i] << " ";
}
using clang, this will print:
1 2 2 2
using msvc or gcc, this will print:
1 2 3 4
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170907/ed568b17/attachment.html>
More information about the llvm-bugs
mailing list