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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [iop.C] - Blame information for rev 378

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// I, Howard Hinnant, hereby place this code in the public domain.
2
 
3
// Test that the implicit object parameter is *not* an rvalue reference, but is instead
4
//   identical to that specified in C++03.  That is, the implicit object parameter is
5
//   an lvalue reference that can bind to an rvalue. :-\
6
//   See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html under the
7
//   section "Revision 1 Summary and Rationale" for more details.
8
 
9
// { dg-do compile }
10
// { dg-options "-std=c++0x" }
11
 
12
template  struct sa;
13
template <> struct sa {};
14
 
15 378 julius
struct one   {long x[1];};
16
struct two   {long x[2];};
17 301 jeremybenn
 
18
struct os
19
{
20
    one operator<<(int);
21
};
22
 
23
struct A
24
{
25
    A(int);
26
};
27
 
28
two operator<<(os&, const A&);
29
 
30
void test()
31
{
32
    os o;
33 378 julius
    sa t1;  // Calls os::operator<<(int)
34 301 jeremybenn
                                 // Would be ambiguous if the implicit object parameter
35
                                 // was an rvalue reference.
36
}
37
 
38
int main()
39
{
40
    return 0;
41
}

powered by: WebSVN 2.1.0

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