URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 301 |
Rev 384 |
// Test for initializer-list 'explicit' rule
|
// Test for initializer-list 'explicit' rule
|
// { dg-options "-std=c++0x" }
|
// { dg-options "-std=c++0x" }
|
|
|
struct A
|
struct A
|
{
|
{
|
explicit A(int,int);
|
explicit A(int,int);
|
operator bool();
|
operator bool();
|
};
|
};
|
|
|
A f(A)
|
A f(A)
|
{
|
{
|
A{1,2};
|
A{1,2};
|
A a1{1,2};
|
A a1{1,2};
|
new A{1,2};
|
new A{1,2};
|
if (A a5{1,2});
|
if (A a5{1,2});
|
|
|
A({1,2}); // { dg-error "explicit" }
|
A({1,2}); // { dg-error "explicit" }
|
A a2({1,2}); // { dg-error "explicit" }
|
A a2({1,2}); // { dg-error "explicit" }
|
A a3 = {1,2}; // { dg-error "explicit" }
|
A a3 = {1,2}; // { dg-error "explicit" }
|
new A({1,2}); // { dg-error "explicit" }
|
new A({1,2}); // { dg-error "explicit" }
|
f({1,2}); // { dg-error "explicit" }
|
f({1,2}); // { dg-error "explicit" }
|
a1 = {1,2}; // { dg-error "explicit" }
|
a1 = {1,2}; // { dg-error "explicit" }
|
if (A a4 = {1,2}); // { dg-error "explicit" }
|
if (A a4 = {1,2}); // { dg-error "explicit" }
|
return {1,2}; // { dg-error "explicit" }
|
return {1,2}; // { dg-error "explicit" }
|
}
|
}
|
|
|
struct B
|
struct B
|
{
|
{
|
A a;
|
A a;
|
B(): a{1,2} {}
|
B(): a{1,2} {}
|
B(const B&): a({1,2}) {} // { dg-error "explicit" }
|
B(const B&): a({1,2}) {} // { dg-error "explicit" }
|
};
|
};
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.