diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/cpp0x/rv7n.C | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/rv7n.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/rv7n.C | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv7n.C b/gcc/testsuite/g++.dg/cpp0x/rv7n.C new file mode 100644 index 000000000..6071e0568 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/rv7n.C @@ -0,0 +1,111 @@ +// I, Howard Hinnant, hereby place this code in the public domain. + +// Test overload resolution among reference types + +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template <bool> struct sa; +template <> struct sa<true> {}; + +struct one {char x[1];}; +struct two {char x[2];}; +struct three {char x[3];}; +struct four {char x[4];}; +struct five {char x[5];}; +struct six {char x[6];}; +struct seven {char x[7];}; +struct eight {char x[8];}; + +struct A +{ + A(); + A(const volatile A&&); // { dg-error "argument 1" } +}; + + A source(); +const A c_source(); + volatile A v_source(); +const volatile A cv_source(); + +// 7 at a time + +one sink_7_1234567( A&); // { dg-message "one sink_7_1234567|no known conversion" } +two sink_7_1234567(const A&); // { dg-message "note" } +three sink_7_1234567(volatile A&); // { dg-message "note" } +four sink_7_1234567(const volatile A&); // { dg-message "note" } +five sink_7_1234567( A&&); // { dg-message "note" } +six sink_7_1234567(const A&&); // { dg-message "note" } +seven sink_7_1234567(volatile A&&); // { dg-message "note" } + +int test7_1234567() +{ + A a; + const A ca = a; // { dg-error "lvalue" } + volatile A va; + const volatile A cva = a; // { dg-error "lvalue" } + sink_7_1234567(cv_source()); // { dg-error "no match" } + // { dg-message "candidate" "candidate note" { target *-*-* } 47 } + return 0; +} + +one sink_7_1235678( A&); +two sink_7_1235678(const A&); +three sink_7_1235678(volatile A&); +five sink_7_1235678( A&&); +six sink_7_1235678(const A&&); +seven sink_7_1235678(volatile A&&); +eight sink_7_1235678(const volatile A&&); // { dg-message "" } + +int test7_1235678() +{ + A a; + const A ca = a; // { dg-error "lvalue" } + volatile A va; + const volatile A cva = a; // { dg-error "lvalue" } + sink_7_1235678(cva); // { dg-error "lvalue" } + return 0; +} + +two sink_7_2345678(const A&); // { dg-message "note" } +three sink_7_2345678(volatile A&); // { dg-message "note" } +four sink_7_2345678(const volatile A&); // { dg-message "note" } +five sink_7_2345678( A&&); // { dg-message "note" } +six sink_7_2345678(const A&&); // { dg-message "note" } +seven sink_7_2345678(volatile A&&); // { dg-message "note" } +eight sink_7_2345678(const volatile A&&); // { dg-message "note" } + +int test7_2345678() +{ + A a; + const A ca = a; // { dg-error "lvalue" } + volatile A va; + const volatile A cva = a; // { dg-error "lvalue" } + sink_7_2345678(a); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 84 } + return 0; +} + +one sink_7_1234678( A&); +two sink_7_1234678(const A&); // { dg-message "note" } +three sink_7_1234678(volatile A&); +four sink_7_1234678(const volatile A&); +six sink_7_1234678(const A&&); // { dg-message "note" } +seven sink_7_1234678(volatile A&&); // { dg-message "note" } +eight sink_7_1234678(const volatile A&&); // { dg-message "note" } + +int test7_1234678() +{ + A a; + const A ca = a; // { dg-error "lvalue" } + volatile A va; + const volatile A cva = a; // { dg-error "lvalue" } + sink_7_1234678(source()); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 103 } + return 0; +} + +int main() +{ + return test7_2345678() + test7_1234678(); +} |