OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [rv-trivial-bug.C] - Rev 338

Compare with Previous | Blame | View Log

// { dg-do "run" }
// { dg-options "-std=c++0x" }
// PR c++/33235
#include <cassert>

int move_construct = 0;
int move_assign = 0;

struct base2
{
    base2() {}
    base2(base2&&) {++move_construct;}
    base2& operator=(base2&&) {++move_assign; return *this;}
};

int test2()
{
    base2 b;
    base2 b2(b);
    assert(move_construct == 0);
    base2 b3(static_cast<base2&&>(b));
    base2 b4 = static_cast<base2&&>(b);
    assert(move_construct == 2);
    b = b2;
    assert(move_assign == 0);
    b = static_cast<base2&&>(b2);
    assert(move_assign == 1);
}

int main()
{
    test2();
    return 0;
}

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.