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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [range-for6.C] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Test for range-based for loop
2
// Test the loop with an initializer_list
3
 
4
// { dg-do run }
5
// { dg-options "-std=c++0x" }
6
 
7
#include 
8
 
9
extern "C" void abort();
10
 
11
template T foo()
12
{
13
    T sum = 0;
14
    for (T x : {T(1),T(2),T(3),T(4)})
15
        sum += x;
16
    if (sum != T(10))
17
        abort();
18
}
19
 
20
int main()
21
{
22
    int sum = 0;
23
    for (int x : {1,2,3,4})
24
        sum += x;
25
    if (sum != 10)
26
        abort();
27
 
28
    foo();
29
}

powered by: WebSVN 2.1.0

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