From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/g++.dg/cpp0x/__func__.C | 6 + gcc/testsuite/g++.dg/cpp0x/access01.C | 15 + gcc/testsuite/g++.dg/cpp0x/alignof.C | 5 + gcc/testsuite/g++.dg/cpp0x/alignof2.C | 7 + gcc/testsuite/g++.dg/cpp0x/auto1.C | 8 + gcc/testsuite/g++.dg/cpp0x/auto10.C | 22 + gcc/testsuite/g++.dg/cpp0x/auto11.C | 12 + gcc/testsuite/g++.dg/cpp0x/auto14.C | 29 + gcc/testsuite/g++.dg/cpp0x/auto15.C | 13 + gcc/testsuite/g++.dg/cpp0x/auto16.C | 7 + gcc/testsuite/g++.dg/cpp0x/auto17.C | 10 + gcc/testsuite/g++.dg/cpp0x/auto18.C | 6 + gcc/testsuite/g++.dg/cpp0x/auto19.C | 8 + gcc/testsuite/g++.dg/cpp0x/auto2.C | 74 + gcc/testsuite/g++.dg/cpp0x/auto20.C | 20 + gcc/testsuite/g++.dg/cpp0x/auto21.C | 5 + gcc/testsuite/g++.dg/cpp0x/auto22.C | 21 + gcc/testsuite/g++.dg/cpp0x/auto23.C | 4 + gcc/testsuite/g++.dg/cpp0x/auto3.C | 27 + gcc/testsuite/g++.dg/cpp0x/auto31.C | 12 + gcc/testsuite/g++.dg/cpp0x/auto4.C | 28 + gcc/testsuite/g++.dg/cpp0x/auto5.C | 22 + gcc/testsuite/g++.dg/cpp0x/auto7.C | 13 + gcc/testsuite/g++.dg/cpp0x/auto9.C | 124 ++ gcc/testsuite/g++.dg/cpp0x/bind.C | 8 + gcc/testsuite/g++.dg/cpp0x/bracket1.C | 16 + gcc/testsuite/g++.dg/cpp0x/bracket2.C | 11 + gcc/testsuite/g++.dg/cpp0x/bracket3.C | 10 + gcc/testsuite/g++.dg/cpp0x/bracket4.C | 35 + gcc/testsuite/g++.dg/cpp0x/cast-bug.C | 14 + gcc/testsuite/g++.dg/cpp0x/cast.C | 30 + gcc/testsuite/g++.dg/cpp0x/collapse-bug.C | 16 + gcc/testsuite/g++.dg/cpp0x/collapse.C | 38 + gcc/testsuite/g++.dg/cpp0x/constexpr-46420.C | 13 + gcc/testsuite/g++.dg/cpp0x/constexpr-47570.C | 25 + gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C | 50 + gcc/testsuite/g++.dg/cpp0x/constexpr-98.C | 4 + gcc/testsuite/g++.dg/cpp0x/constexpr-access.C | 14 + gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr.C | 15 + gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr2.C | 21 + gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr3.C | 19 + gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr4.C | 23 + gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr5.C | 32 + gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr6.C | 18 + gcc/testsuite/g++.dg/cpp0x/constexpr-array-tparm.C | 5 + gcc/testsuite/g++.dg/cpp0x/constexpr-array.C | 15 + gcc/testsuite/g++.dg/cpp0x/constexpr-array2.C | 19 + gcc/testsuite/g++.dg/cpp0x/constexpr-array3.C | 14 + gcc/testsuite/g++.dg/cpp0x/constexpr-array4.C | 14 + gcc/testsuite/g++.dg/cpp0x/constexpr-attribute.C | 63 + gcc/testsuite/g++.dg/cpp0x/constexpr-auto.C | 2 + gcc/testsuite/g++.dg/cpp0x/constexpr-base.C | 17 + gcc/testsuite/g++.dg/cpp0x/constexpr-base2.C | 19 + gcc/testsuite/g++.dg/cpp0x/constexpr-base3.C | 27 + gcc/testsuite/g++.dg/cpp0x/constexpr-base4.C | 28 + gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield.C | 10 + gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield2.C | 19 + gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield3.C | 33 + gcc/testsuite/g++.dg/cpp0x/constexpr-cleanup.C | 9 + gcc/testsuite/g++.dg/cpp0x/constexpr-complex.C | 17 + gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C | 9 + gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C | 18 + gcc/testsuite/g++.dg/cpp0x/constexpr-ctor.C | 7 + gcc/testsuite/g++.dg/cpp0x/constexpr-ctor2.C | 11 + gcc/testsuite/g++.dg/cpp0x/constexpr-ctor3.C | 10 + gcc/testsuite/g++.dg/cpp0x/constexpr-ctor4.C | 15 + gcc/testsuite/g++.dg/cpp0x/constexpr-ctor5.C | 30 + gcc/testsuite/g++.dg/cpp0x/constexpr-ctor6.C | 9 + gcc/testsuite/g++.dg/cpp0x/constexpr-ctor7.C | 17 + gcc/testsuite/g++.dg/cpp0x/constexpr-ctor8.C | 6 + gcc/testsuite/g++.dg/cpp0x/constexpr-ctor9.C | 19 + gcc/testsuite/g++.dg/cpp0x/constexpr-data1.C | 43 + gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C | 47 + gcc/testsuite/g++.dg/cpp0x/constexpr-decl.C | 10 + gcc/testsuite/g++.dg/cpp0x/constexpr-defarg.C | 12 + gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C | 44 + gcc/testsuite/g++.dg/cpp0x/constexpr-delete.C | 3 + gcc/testsuite/g++.dg/cpp0x/constexpr-deref.C | 16 + gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C | 20 + gcc/testsuite/g++.dg/cpp0x/constexpr-diag2.C | 5 + gcc/testsuite/g++.dg/cpp0x/constexpr-eh-spec.C | 9 + gcc/testsuite/g++.dg/cpp0x/constexpr-ellipsis.C | 5 + gcc/testsuite/g++.dg/cpp0x/constexpr-ellipsis2.C | 12 + gcc/testsuite/g++.dg/cpp0x/constexpr-empty.C | 7 + gcc/testsuite/g++.dg/cpp0x/constexpr-empty2.C | 7 + gcc/testsuite/g++.dg/cpp0x/constexpr-empty3.C | 9 + gcc/testsuite/g++.dg/cpp0x/constexpr-empty4.C | 34 + gcc/testsuite/g++.dg/cpp0x/constexpr-empty5.C | 7 + gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C | 94 ++ gcc/testsuite/g++.dg/cpp0x/constexpr-ex2.C | 23 + gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C | 30 + gcc/testsuite/g++.dg/cpp0x/constexpr-ex4.C | 16 + gcc/testsuite/g++.dg/cpp0x/constexpr-expinst.C | 5 + .../g++.dg/cpp0x/constexpr-explicit-inst.C | 9 + gcc/testsuite/g++.dg/cpp0x/constexpr-fnptr.C | 7 + gcc/testsuite/g++.dg/cpp0x/constexpr-friend.C | 23 + gcc/testsuite/g++.dg/cpp0x/constexpr-function1.C | 10 + gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C | 50 + gcc/testsuite/g++.dg/cpp0x/constexpr-function3.C | 30 + gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C | 11 + gcc/testsuite/g++.dg/cpp0x/constexpr-ice2.C | 3 + gcc/testsuite/g++.dg/cpp0x/constexpr-ice3.C | 13 + gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete1.C | 7 + gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C | 31 + gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete3.C | 12 + gcc/testsuite/g++.dg/cpp0x/constexpr-initlist.C | 65 + gcc/testsuite/g++.dg/cpp0x/constexpr-initlist2.C | 10 + gcc/testsuite/g++.dg/cpp0x/constexpr-initlist3.C | 12 + gcc/testsuite/g++.dg/cpp0x/constexpr-initlist5.C | 15 + gcc/testsuite/g++.dg/cpp0x/constexpr-is_literal.C | 38 + gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C | 18 + gcc/testsuite/g++.dg/cpp0x/constexpr-missing.C | 39 + gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C | 69 + gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept.C | 13 + gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept2.C | 14 + gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept3.C | 7 + gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept4.C | 14 + gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C | 15 + .../g++.dg/cpp0x/constexpr-non-const-arg.C | 24 + .../g++.dg/cpp0x/constexpr-non-const-arg2.C | 16 + .../g++.dg/cpp0x/constexpr-non-const-arg3.C | 23 + gcc/testsuite/g++.dg/cpp0x/constexpr-nonlit.C | 13 + gcc/testsuite/g++.dg/cpp0x/constexpr-nonlit2.C | 19 + gcc/testsuite/g++.dg/cpp0x/constexpr-nonstatic.C | 6 + gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr.C | 6 + gcc/testsuite/g++.dg/cpp0x/constexpr-object1.C | 31 + gcc/testsuite/g++.dg/cpp0x/constexpr-object2.C | 16 + gcc/testsuite/g++.dg/cpp0x/constexpr-overflow.C | 6 + gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C | 8 + gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C | 16 + gcc/testsuite/g++.dg/cpp0x/constexpr-pos1.C | 60 + gcc/testsuite/g++.dg/cpp0x/constexpr-potential1.C | 7 + gcc/testsuite/g++.dg/cpp0x/constexpr-ptrmem.C | 20 + gcc/testsuite/g++.dg/cpp0x/constexpr-pure.C | 13 + gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C | 5 + gcc/testsuite/g++.dg/cpp0x/constexpr-sassert.C | 13 + gcc/testsuite/g++.dg/cpp0x/constexpr-static.C | 24 + gcc/testsuite/g++.dg/cpp0x/constexpr-static2.C | 11 + gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C | 18 + gcc/testsuite/g++.dg/cpp0x/constexpr-static4.C | 20 + gcc/testsuite/g++.dg/cpp0x/constexpr-static5.C | 17 + gcc/testsuite/g++.dg/cpp0x/constexpr-static6.C | 21 + gcc/testsuite/g++.dg/cpp0x/constexpr-static7.C | 8 + gcc/testsuite/g++.dg/cpp0x/constexpr-stmtexpr.C | 8 + gcc/testsuite/g++.dg/cpp0x/constexpr-string.C | 5 + gcc/testsuite/g++.dg/cpp0x/constexpr-switch.C | 13 + gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C | 23 + gcc/testsuite/g++.dg/cpp0x/constexpr-synth1.C | 14 + gcc/testsuite/g++.dg/cpp0x/constexpr-targ.C | 13 + gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C | 8 + gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C | 11 + gcc/testsuite/g++.dg/cpp0x/constexpr-typeid.C | 10 + gcc/testsuite/g++.dg/cpp0x/constexpr-union.C | 16 + gcc/testsuite/g++.dg/cpp0x/constexpr-value.C | 10 + gcc/testsuite/g++.dg/cpp0x/constexpr-value2.C | 19 + gcc/testsuite/g++.dg/cpp0x/constexpr-value3.C | 10 + gcc/testsuite/g++.dg/cpp0x/constexpr-variadic.C | 9 + gcc/testsuite/g++.dg/cpp0x/constexpr-virtual.C | 14 + gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C | 34 + gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C | 7 + gcc/testsuite/g++.dg/cpp0x/decltype-33837.C | 7 + gcc/testsuite/g++.dg/cpp0x/decltype-33838.C | 6 + gcc/testsuite/g++.dg/cpp0x/decltype-38655.C | 4 + gcc/testsuite/g++.dg/cpp0x/decltype-refbug.C | 17 + gcc/testsuite/g++.dg/cpp0x/decltype1.C | 28 + gcc/testsuite/g++.dg/cpp0x/decltype10.C | 10 + gcc/testsuite/g++.dg/cpp0x/decltype11.C | 12 + gcc/testsuite/g++.dg/cpp0x/decltype12.C | 38 + gcc/testsuite/g++.dg/cpp0x/decltype13.C | 38 + gcc/testsuite/g++.dg/cpp0x/decltype14.C | 17 + gcc/testsuite/g++.dg/cpp0x/decltype15.C | 13 + gcc/testsuite/g++.dg/cpp0x/decltype16.C | 10 + gcc/testsuite/g++.dg/cpp0x/decltype17.C | 29 + gcc/testsuite/g++.dg/cpp0x/decltype18.C | 5 + gcc/testsuite/g++.dg/cpp0x/decltype19.C | 24 + gcc/testsuite/g++.dg/cpp0x/decltype2.C | 59 + gcc/testsuite/g++.dg/cpp0x/decltype20.C | 10 + gcc/testsuite/g++.dg/cpp0x/decltype22.C | 13 + gcc/testsuite/g++.dg/cpp0x/decltype23.C | 5 + gcc/testsuite/g++.dg/cpp0x/decltype24.C | 7 + gcc/testsuite/g++.dg/cpp0x/decltype25.C | 20 + gcc/testsuite/g++.dg/cpp0x/decltype27.C | 9 + gcc/testsuite/g++.dg/cpp0x/decltype3.C | 72 + gcc/testsuite/g++.dg/cpp0x/decltype30.C | 17 + gcc/testsuite/g++.dg/cpp0x/decltype31.C | 13 + gcc/testsuite/g++.dg/cpp0x/decltype35.C | 15 + gcc/testsuite/g++.dg/cpp0x/decltype36.C | 21 + gcc/testsuite/g++.dg/cpp0x/decltype4.C | 83 ++ gcc/testsuite/g++.dg/cpp0x/decltype5.C | 38 + gcc/testsuite/g++.dg/cpp0x/decltype6.C | 36 + gcc/testsuite/g++.dg/cpp0x/decltype7.C | 14 + gcc/testsuite/g++.dg/cpp0x/decltype8.C | 12 + gcc/testsuite/g++.dg/cpp0x/decltype9.C | 10 + gcc/testsuite/g++.dg/cpp0x/deduce.C | 36 + gcc/testsuite/g++.dg/cpp0x/defaulted1.C | 43 + gcc/testsuite/g++.dg/cpp0x/defaulted10.C | 14 + gcc/testsuite/g++.dg/cpp0x/defaulted11.C | 15 + gcc/testsuite/g++.dg/cpp0x/defaulted13.C | 29 + gcc/testsuite/g++.dg/cpp0x/defaulted14.C | 20 + gcc/testsuite/g++.dg/cpp0x/defaulted15.C | 58 + gcc/testsuite/g++.dg/cpp0x/defaulted16.C | 13 + gcc/testsuite/g++.dg/cpp0x/defaulted17.C | 12 + gcc/testsuite/g++.dg/cpp0x/defaulted18.C | 10 + gcc/testsuite/g++.dg/cpp0x/defaulted19.C | 21 + gcc/testsuite/g++.dg/cpp0x/defaulted2.C | 69 + gcc/testsuite/g++.dg/cpp0x/defaulted20.C | 20 + gcc/testsuite/g++.dg/cpp0x/defaulted21.C | 20 + gcc/testsuite/g++.dg/cpp0x/defaulted24.C | 6 + gcc/testsuite/g++.dg/cpp0x/defaulted26.C | 7 + gcc/testsuite/g++.dg/cpp0x/defaulted27.C | 19 + gcc/testsuite/g++.dg/cpp0x/defaulted29.C | 20 + gcc/testsuite/g++.dg/cpp0x/defaulted3.C | 16 + gcc/testsuite/g++.dg/cpp0x/defaulted30.C | 16 + gcc/testsuite/g++.dg/cpp0x/defaulted32.C | 21 + gcc/testsuite/g++.dg/cpp0x/defaulted4.C | 26 + gcc/testsuite/g++.dg/cpp0x/defaulted5.C | 20 + gcc/testsuite/g++.dg/cpp0x/defaulted6.C | 13 + gcc/testsuite/g++.dg/cpp0x/defaulted7.C | 12 + gcc/testsuite/g++.dg/cpp0x/defaulted8.C | 8 + gcc/testsuite/g++.dg/cpp0x/defaulted9.C | 20 + gcc/testsuite/g++.dg/cpp0x/dependent1.C | 25 + gcc/testsuite/g++.dg/cpp0x/elision.C | 76 + gcc/testsuite/g++.dg/cpp0x/elision2.C | 13 + gcc/testsuite/g++.dg/cpp0x/elision_neg.C | 44 + gcc/testsuite/g++.dg/cpp0x/elision_weak.C | 19 + gcc/testsuite/g++.dg/cpp0x/enum1.C | 6 + gcc/testsuite/g++.dg/cpp0x/enum10.C | 9 + gcc/testsuite/g++.dg/cpp0x/enum13.C | 20 + gcc/testsuite/g++.dg/cpp0x/enum15.C | 20 + gcc/testsuite/g++.dg/cpp0x/enum16.C | 6 + gcc/testsuite/g++.dg/cpp0x/enum18.C | 8 + gcc/testsuite/g++.dg/cpp0x/enum19.C | 12 + gcc/testsuite/g++.dg/cpp0x/enum2.C | 5 + gcc/testsuite/g++.dg/cpp0x/enum3.C | 27 + gcc/testsuite/g++.dg/cpp0x/enum4.C | 8 + gcc/testsuite/g++.dg/cpp0x/enum5.C | 20 + gcc/testsuite/g++.dg/cpp0x/enum6.C | 15 + gcc/testsuite/g++.dg/cpp0x/enum7.C | 11 + gcc/testsuite/g++.dg/cpp0x/enum8.C | 10 + gcc/testsuite/g++.dg/cpp0x/enum9.C | 5 + gcc/testsuite/g++.dg/cpp0x/enum_base.C | 25 + gcc/testsuite/g++.dg/cpp0x/enum_base_warn.C | 25 + gcc/testsuite/g++.dg/cpp0x/error1.C | 11 + gcc/testsuite/g++.dg/cpp0x/error2.C | 9 + gcc/testsuite/g++.dg/cpp0x/error3.C | 24 + gcc/testsuite/g++.dg/cpp0x/error4.C | 22 + gcc/testsuite/g++.dg/cpp0x/error6.C | 8 + gcc/testsuite/g++.dg/cpp0x/explicit1.C | 58 + gcc/testsuite/g++.dg/cpp0x/explicit2.C | 29 + gcc/testsuite/g++.dg/cpp0x/explicit3.C | 51 + gcc/testsuite/g++.dg/cpp0x/explicit4.C | 18 + gcc/testsuite/g++.dg/cpp0x/explicit5.C | 25 + gcc/testsuite/g++.dg/cpp0x/extern_template-1.C | 4 + gcc/testsuite/g++.dg/cpp0x/extern_template-2.C | 4 + gcc/testsuite/g++.dg/cpp0x/extern_template-3.C | 16 + gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C | 7 + gcc/testsuite/g++.dg/cpp0x/fntmpdefarg2.C | 14 + gcc/testsuite/g++.dg/cpp0x/forw_enum1.C | 45 + gcc/testsuite/g++.dg/cpp0x/forw_enum2.C | 44 + gcc/testsuite/g++.dg/cpp0x/forw_enum3.C | 44 + gcc/testsuite/g++.dg/cpp0x/forw_enum4.C | 45 + gcc/testsuite/g++.dg/cpp0x/forw_enum5.C | 63 + gcc/testsuite/g++.dg/cpp0x/forw_enum6.C | 74 + gcc/testsuite/g++.dg/cpp0x/forw_enum7.C | 21 + gcc/testsuite/g++.dg/cpp0x/forw_enum8.C | 26 + gcc/testsuite/g++.dg/cpp0x/forw_enum9.C | 21 + gcc/testsuite/g++.dg/cpp0x/implicit-copy.C | 15 + gcc/testsuite/g++.dg/cpp0x/implicit-trivial1.C | 23 + gcc/testsuite/g++.dg/cpp0x/implicit1.C | 26 + gcc/testsuite/g++.dg/cpp0x/implicit10.C | 19 + gcc/testsuite/g++.dg/cpp0x/implicit2.C | 33 + gcc/testsuite/g++.dg/cpp0x/implicit3.C | 56 + gcc/testsuite/g++.dg/cpp0x/implicit4.C | 21 + gcc/testsuite/g++.dg/cpp0x/implicit5.C | 19 + gcc/testsuite/g++.dg/cpp0x/implicit6.C | 23 + gcc/testsuite/g++.dg/cpp0x/implicit7.C | 37 + gcc/testsuite/g++.dg/cpp0x/implicit8.C | 34 + gcc/testsuite/g++.dg/cpp0x/implicit9.C | 12 + gcc/testsuite/g++.dg/cpp0x/initlist-49216.C | 6 + gcc/testsuite/g++.dg/cpp0x/initlist-array2.C | 12 + gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C | 5 + gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C | 26 + gcc/testsuite/g++.dg/cpp0x/initlist-opt.C | 19 + gcc/testsuite/g++.dg/cpp0x/initlist1.C | 72 + gcc/testsuite/g++.dg/cpp0x/initlist10.C | 53 + gcc/testsuite/g++.dg/cpp0x/initlist11.C | 18 + gcc/testsuite/g++.dg/cpp0x/initlist12.C | 21 + gcc/testsuite/g++.dg/cpp0x/initlist13.C | 8 + gcc/testsuite/g++.dg/cpp0x/initlist14.C | 19 + gcc/testsuite/g++.dg/cpp0x/initlist15.C | 20 + gcc/testsuite/g++.dg/cpp0x/initlist16.C | 12 + gcc/testsuite/g++.dg/cpp0x/initlist17.C | 9 + gcc/testsuite/g++.dg/cpp0x/initlist18.C | 19 + gcc/testsuite/g++.dg/cpp0x/initlist19.C | 10 + gcc/testsuite/g++.dg/cpp0x/initlist2.C | 32 + gcc/testsuite/g++.dg/cpp0x/initlist20.C | 17 + gcc/testsuite/g++.dg/cpp0x/initlist21.C | 18 + gcc/testsuite/g++.dg/cpp0x/initlist22.C | 24 + gcc/testsuite/g++.dg/cpp0x/initlist23.C | 15 + gcc/testsuite/g++.dg/cpp0x/initlist24.C | 9 + gcc/testsuite/g++.dg/cpp0x/initlist25.C | 17 + gcc/testsuite/g++.dg/cpp0x/initlist26.C | 10 + gcc/testsuite/g++.dg/cpp0x/initlist27.C | 5 + gcc/testsuite/g++.dg/cpp0x/initlist28.C | 8 + gcc/testsuite/g++.dg/cpp0x/initlist29.C | 14 + gcc/testsuite/g++.dg/cpp0x/initlist3.C | 11 + gcc/testsuite/g++.dg/cpp0x/initlist30.C | 12 + gcc/testsuite/g++.dg/cpp0x/initlist31.C | 13 + gcc/testsuite/g++.dg/cpp0x/initlist32.C | 21 + gcc/testsuite/g++.dg/cpp0x/initlist33.C | 13 + gcc/testsuite/g++.dg/cpp0x/initlist34.C | 14 + gcc/testsuite/g++.dg/cpp0x/initlist35.C | 24 + gcc/testsuite/g++.dg/cpp0x/initlist36.C | 23 + gcc/testsuite/g++.dg/cpp0x/initlist37.C | 24 + gcc/testsuite/g++.dg/cpp0x/initlist38.C | 21 + gcc/testsuite/g++.dg/cpp0x/initlist39.C | 15 + gcc/testsuite/g++.dg/cpp0x/initlist4.C | 32 + gcc/testsuite/g++.dg/cpp0x/initlist40.C | 12 + gcc/testsuite/g++.dg/cpp0x/initlist41.C | 14 + gcc/testsuite/g++.dg/cpp0x/initlist42.C | 13 + gcc/testsuite/g++.dg/cpp0x/initlist43.C | 7 + gcc/testsuite/g++.dg/cpp0x/initlist44.C | 5 + gcc/testsuite/g++.dg/cpp0x/initlist45.C | 13 + gcc/testsuite/g++.dg/cpp0x/initlist46.C | 14 + gcc/testsuite/g++.dg/cpp0x/initlist47.C | 9 + gcc/testsuite/g++.dg/cpp0x/initlist48.C | 11 + gcc/testsuite/g++.dg/cpp0x/initlist5.C | 27 + gcc/testsuite/g++.dg/cpp0x/initlist50.C | 21 + gcc/testsuite/g++.dg/cpp0x/initlist51.C | 15 + gcc/testsuite/g++.dg/cpp0x/initlist57.C | 8 + gcc/testsuite/g++.dg/cpp0x/initlist6.C | 30 + gcc/testsuite/g++.dg/cpp0x/initlist7.C | 12 + gcc/testsuite/g++.dg/cpp0x/initlist8.C | 19 + gcc/testsuite/g++.dg/cpp0x/initlist9.C | 29 + gcc/testsuite/g++.dg/cpp0x/inline-ns1.C | 12 + gcc/testsuite/g++.dg/cpp0x/inline-ns2.C | 25 + gcc/testsuite/g++.dg/cpp0x/inline-ns3.C | 26 + gcc/testsuite/g++.dg/cpp0x/inline-ns4.C | 2 + gcc/testsuite/g++.dg/cpp0x/inline-ns5.C | 2 + gcc/testsuite/g++.dg/cpp0x/iop.C | 41 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-50220.C | 9 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-98.C | 8 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array.C | 20 + .../cpp0x/lambda/lambda-capture-const-ref-neg.C | 14 + .../g++.dg/cpp0x/lambda/lambda-capture-const-ref.C | 15 + .../g++.dg/cpp0x/lambda/lambda-const-neg.C | 19 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const.C | 20 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C | 14 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv2.C | 12 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv3.C | 12 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv4.C | 13 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv5.C | 15 + .../g++.dg/cpp0x/lambda/lambda-copy-default-neg.C | 13 + .../g++.dg/cpp0x/lambda/lambda-copy-default.C | 14 + .../g++.dg/cpp0x/lambda/lambda-copy-neg.C | 13 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy.C | 14 + .../g++.dg/cpp0x/lambda/lambda-ctor-neg.C | 25 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctors.C | 18 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-debug.C | 15 + .../g++.dg/cpp0x/lambda/lambda-deduce-ext-neg.C | 24 + .../g++.dg/cpp0x/lambda/lambda-deduce-ext-neg2.C | 22 + .../g++.dg/cpp0x/lambda/lambda-deduce-ext.C | 27 + .../g++.dg/cpp0x/lambda/lambda-deduce-neg.C | 10 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce.C | 29 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C | 7 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg.C | 6 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg2.C | 7 + .../g++.dg/cpp0x/lambda/lambda-direct-init.C | 14 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C | 35 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C | 17 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C | 18 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C | 19 + .../g++.dg/cpp0x/lambda/lambda-field-names.C | 21 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice1.C | 13 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C | 16 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C | 23 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice4.C | 14 + .../g++.dg/cpp0x/lambda/lambda-in-class-neg.C | 35 + .../g++.dg/cpp0x/lambda/lambda-in-class.C | 36 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-init.C | 8 + .../g++.dg/cpp0x/lambda/lambda-lookup-neg.C | 7 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle.C | 103 ++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C | 21 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mixed.C | 13 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable.C | 16 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested.C | 63 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C | 31 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested3.C | 12 + .../g++.dg/cpp0x/lambda/lambda-non-const.C | 19 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C | 19 + .../g++.dg/cpp0x/lambda/lambda-ns-scope.C | 18 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-pass.C | 27 + .../g++.dg/cpp0x/lambda/lambda-qualified.C | 17 + .../g++.dg/cpp0x/lambda/lambda-recursive.C | 21 + .../g++.dg/cpp0x/lambda/lambda-ref-default.C | 15 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref.C | 15 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref2.C | 13 + .../g++.dg/cpp0x/lambda/lambda-std-function.C | 22 + .../g++.dg/cpp0x/lambda/lambda-template.C | 41 + .../g++.dg/cpp0x/lambda/lambda-template2.C | 20 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C | 13 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C | 17 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this3.C | 14 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C | 13 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-type.C | 74 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-uneval.C | 7 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use.C | 12 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use2.C | 11 + .../g++.dg/cpp0x/lambda/lambda-variadic1.C | 15 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn1.C | 8 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn2.C | 7 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C | 12 + gcc/testsuite/g++.dg/cpp0x/linkage2.C | 33 + gcc/testsuite/g++.dg/cpp0x/long_long.C | 6 + gcc/testsuite/g++.dg/cpp0x/move1.C | 15 + gcc/testsuite/g++.dg/cpp0x/named.C | 40 + gcc/testsuite/g++.dg/cpp0x/named_refs.C | 28 + gcc/testsuite/g++.dg/cpp0x/noexcept01.C | 83 ++ gcc/testsuite/g++.dg/cpp0x/noexcept02.C | 54 + gcc/testsuite/g++.dg/cpp0x/noexcept03.C | 51 + gcc/testsuite/g++.dg/cpp0x/noexcept04.C | 31 + gcc/testsuite/g++.dg/cpp0x/noexcept05.C | 19 + gcc/testsuite/g++.dg/cpp0x/noexcept06.C | 30 + gcc/testsuite/g++.dg/cpp0x/noexcept07.C | 25 + gcc/testsuite/g++.dg/cpp0x/noexcept08.C | 56 + gcc/testsuite/g++.dg/cpp0x/noexcept09.C | 14 + gcc/testsuite/g++.dg/cpp0x/noexcept10.C | 27 + gcc/testsuite/g++.dg/cpp0x/noexcept11.C | 4 + gcc/testsuite/g++.dg/cpp0x/nolinkage1.C | 22 + gcc/testsuite/g++.dg/cpp0x/nolinkage1.h | 8 + gcc/testsuite/g++.dg/cpp0x/nolinkage1a.cc | 15 + gcc/testsuite/g++.dg/cpp0x/not_special.C | 52 + gcc/testsuite/g++.dg/cpp0x/nullptr01.C | 10 + gcc/testsuite/g++.dg/cpp0x/nullptr02.C | 16 + gcc/testsuite/g++.dg/cpp0x/nullptr03.C | 9 + gcc/testsuite/g++.dg/cpp0x/nullptr04.C | 17 + gcc/testsuite/g++.dg/cpp0x/nullptr05.C | 14 + gcc/testsuite/g++.dg/cpp0x/nullptr06.C | 15 + gcc/testsuite/g++.dg/cpp0x/nullptr07.C | 15 + gcc/testsuite/g++.dg/cpp0x/nullptr08.C | 13 + gcc/testsuite/g++.dg/cpp0x/nullptr09.C | 11 + gcc/testsuite/g++.dg/cpp0x/nullptr10.C | 14 + gcc/testsuite/g++.dg/cpp0x/nullptr11.C | 40 + gcc/testsuite/g++.dg/cpp0x/nullptr12.C | 8 + gcc/testsuite/g++.dg/cpp0x/nullptr13.C | 16 + gcc/testsuite/g++.dg/cpp0x/nullptr14.C | 25 + gcc/testsuite/g++.dg/cpp0x/nullptr15.C | 26 + gcc/testsuite/g++.dg/cpp0x/nullptr16.C | 25 + gcc/testsuite/g++.dg/cpp0x/nullptr17.C | 23 + gcc/testsuite/g++.dg/cpp0x/nullptr18.C | 21 + gcc/testsuite/g++.dg/cpp0x/nullptr19.C | 17 + gcc/testsuite/g++.dg/cpp0x/nullptr20.C | 20 + gcc/testsuite/g++.dg/cpp0x/nullptr21.C | 44 + gcc/testsuite/g++.dg/cpp0x/nullptr22.C | 20 + gcc/testsuite/g++.dg/cpp0x/nullptr28.C | 17 + gcc/testsuite/g++.dg/cpp0x/overload-conv-1.C | 29 + gcc/testsuite/g++.dg/cpp0x/overload-conv-2.C | 17 + gcc/testsuite/g++.dg/cpp0x/overload.C | 708 ++++++++++ gcc/testsuite/g++.dg/cpp0x/overloadn.C | 708 ++++++++++ gcc/testsuite/g++.dg/cpp0x/parse1.C | 5 + gcc/testsuite/g++.dg/cpp0x/pr31431-2.C | 8 + gcc/testsuite/g++.dg/cpp0x/pr31431.C | 8 + gcc/testsuite/g++.dg/cpp0x/pr31432.C | 8 + gcc/testsuite/g++.dg/cpp0x/pr31434.C | 12 + gcc/testsuite/g++.dg/cpp0x/pr31437.C | 10 + gcc/testsuite/g++.dg/cpp0x/pr31438.C | 9 + gcc/testsuite/g++.dg/cpp0x/pr31439.C | 8 + gcc/testsuite/g++.dg/cpp0x/pr31442.C | 9 + gcc/testsuite/g++.dg/cpp0x/pr31443.C | 11 + gcc/testsuite/g++.dg/cpp0x/pr31444.C | 10 + gcc/testsuite/g++.dg/cpp0x/pr31445.C | 8 + gcc/testsuite/g++.dg/cpp0x/pr31993.C | 9 + gcc/testsuite/g++.dg/cpp0x/pr32114.C | 7 + gcc/testsuite/g++.dg/cpp0x/pr32115.C | 4 + gcc/testsuite/g++.dg/cpp0x/pr32125.C | 8 + gcc/testsuite/g++.dg/cpp0x/pr32126.C | 10 + gcc/testsuite/g++.dg/cpp0x/pr32127.C | 7 + gcc/testsuite/g++.dg/cpp0x/pr32128.C | 7 + gcc/testsuite/g++.dg/cpp0x/pr32252.C | 8 + gcc/testsuite/g++.dg/cpp0x/pr32253.C | 9 + gcc/testsuite/g++.dg/cpp0x/pr32566.C | 4 + gcc/testsuite/g++.dg/cpp0x/pr33839.C | 8 + gcc/testsuite/g++.dg/cpp0x/pr33930.C | 10 + gcc/testsuite/g++.dg/cpp0x/pr33955.C | 39 + gcc/testsuite/g++.dg/cpp0x/pr33996.C | 52 + gcc/testsuite/g++.dg/cpp0x/pr34054.C | 5 + gcc/testsuite/g++.dg/cpp0x/pr34056.C | 10 + gcc/testsuite/g++.dg/cpp0x/pr34057.C | 8 + gcc/testsuite/g++.dg/cpp0x/pr34058.C | 10 + gcc/testsuite/g++.dg/cpp0x/pr34060.C | 11 + gcc/testsuite/g++.dg/cpp0x/pr34061.C | 5 + gcc/testsuite/g++.dg/cpp0x/pr38646.C | 12 + gcc/testsuite/g++.dg/cpp0x/pr38795.C | 13 + gcc/testsuite/g++.dg/cpp0x/pr39639.C | 20 + gcc/testsuite/g++.dg/cpp0x/pr42844-2.C | 42 + gcc/testsuite/g++.dg/cpp0x/pr45908.C | 18 + gcc/testsuite/g++.dg/cpp0x/pr47416.C | 225 +++ gcc/testsuite/g++.dg/cpp0x/pr47476.C | 10 + gcc/testsuite/g++.dg/cpp0x/pr48522.C | 24 + gcc/testsuite/g++.dg/cpp0x/pr50491.C | 17 + gcc/testsuite/g++.dg/cpp0x/pr50901.C | 9 + gcc/testsuite/g++.dg/cpp0x/pr51150.C | 20 + gcc/testsuite/g++.dg/cpp0x/range-for1.C | 17 + gcc/testsuite/g++.dg/cpp0x/range-for10.C | 18 + gcc/testsuite/g++.dg/cpp0x/range-for2.C | 41 + gcc/testsuite/g++.dg/cpp0x/range-for3.C | 42 + gcc/testsuite/g++.dg/cpp0x/range-for4.C | 116 ++ gcc/testsuite/g++.dg/cpp0x/range-for5.C | 54 + gcc/testsuite/g++.dg/cpp0x/range-for6.C | 29 + gcc/testsuite/g++.dg/cpp0x/range-for7.C | 117 ++ gcc/testsuite/g++.dg/cpp0x/range-for8.C | 16 + gcc/testsuite/g++.dg/cpp0x/range-for9.C | 11 + gcc/testsuite/g++.dg/cpp0x/reference_collapsing.C | 175 +++ gcc/testsuite/g++.dg/cpp0x/regress/49290.C | 12 + gcc/testsuite/g++.dg/cpp0x/regress/README | 3 + gcc/testsuite/g++.dg/cpp0x/regress/abi-empty7.C | 20 + gcc/testsuite/g++.dg/cpp0x/regress/array1.C | 16 + gcc/testsuite/g++.dg/cpp0x/regress/bitfield-err1.C | 9 + gcc/testsuite/g++.dg/cpp0x/regress/call1.C | 13 + gcc/testsuite/g++.dg/cpp0x/regress/condition1.C | 80 ++ gcc/testsuite/g++.dg/cpp0x/regress/debug-debug7.C | 19 + gcc/testsuite/g++.dg/cpp0x/regress/enum1.C | 8 + .../g++.dg/cpp0x/regress/error-recovery1.C | 9 + gcc/testsuite/g++.dg/cpp0x/regress/ext-cond1.C | 4 + gcc/testsuite/g++.dg/cpp0x/regress/ext-label10.C | 17 + gcc/testsuite/g++.dg/cpp0x/regress/isnan.C | 9 + gcc/testsuite/g++.dg/cpp0x/regress/no-elide1.C | 14 + gcc/testsuite/g++.dg/cpp0x/regress/non-const1.C | 9 + gcc/testsuite/g++.dg/cpp0x/regress/parse-ambig5.C | 8 + gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C | 9 + gcc/testsuite/g++.dg/cpp0x/regress/regress1.C | 10 + gcc/testsuite/g++.dg/cpp0x/regress/regress2.C | 13 + gcc/testsuite/g++.dg/cpp0x/regress/regress3.C | 13 + gcc/testsuite/g++.dg/cpp0x/regress/regress5.C | 16 + .../g++.dg/cpp0x/regress/template-const1.C | 9 + .../g++.dg/cpp0x/regress/template-const2.C | 14 + .../g++.dg/cpp0x/regress/template-function1.C | 29 + gcc/testsuite/g++.dg/cpp0x/regress/value-dep1.C | 7 + gcc/testsuite/g++.dg/cpp0x/rv-bitfield.C | 12 + gcc/testsuite/g++.dg/cpp0x/rv-bitfield2.C | 17 + gcc/testsuite/g++.dg/cpp0x/rv-cast.C | 6 + gcc/testsuite/g++.dg/cpp0x/rv-cast2.C | 21 + gcc/testsuite/g++.dg/cpp0x/rv-cast3.C | 18 + gcc/testsuite/g++.dg/cpp0x/rv-cast4.C | 13 + gcc/testsuite/g++.dg/cpp0x/rv-deduce.C | 8 + gcc/testsuite/g++.dg/cpp0x/rv-deduce2.C | 18 + gcc/testsuite/g++.dg/cpp0x/rv-lvalue-req.C | 12 + gcc/testsuite/g++.dg/cpp0x/rv-reinterpret.C | 11 + gcc/testsuite/g++.dg/cpp0x/rv-restrict.C | 6 + gcc/testsuite/g++.dg/cpp0x/rv-return.C | 18 + gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C | 33 + gcc/testsuite/g++.dg/cpp0x/rv10.C | 15 + gcc/testsuite/g++.dg/cpp0x/rv1n.C | 169 +++ gcc/testsuite/g++.dg/cpp0x/rv1p.C | 145 ++ gcc/testsuite/g++.dg/cpp0x/rv2n.C | 544 ++++++++ gcc/testsuite/g++.dg/cpp0x/rv2p.C | 507 +++++++ gcc/testsuite/g++.dg/cpp0x/rv3n.C | 951 +++++++++++++ gcc/testsuite/g++.dg/cpp0x/rv3p.C | 1070 +++++++++++++++ gcc/testsuite/g++.dg/cpp0x/rv4n.C | 1072 +++++++++++++++ gcc/testsuite/g++.dg/cpp0x/rv4p.C | 1448 ++++++++++++++++++++ gcc/testsuite/g++.dg/cpp0x/rv5n.C | 806 +++++++++++ gcc/testsuite/g++.dg/cpp0x/rv5p.C | 1256 +++++++++++++++++ gcc/testsuite/g++.dg/cpp0x/rv6n.C | 372 +++++ gcc/testsuite/g++.dg/cpp0x/rv6p.C | 687 ++++++++++ gcc/testsuite/g++.dg/cpp0x/rv7n.C | 111 ++ gcc/testsuite/g++.dg/cpp0x/rv7p.C | 233 ++++ gcc/testsuite/g++.dg/cpp0x/rv8p.C | 62 + gcc/testsuite/g++.dg/cpp0x/rv9p.C | 22 + gcc/testsuite/g++.dg/cpp0x/rvo.C | 25 + gcc/testsuite/g++.dg/cpp0x/scoped_enum.C | 76 + gcc/testsuite/g++.dg/cpp0x/scoped_enum2.C | 11 + gcc/testsuite/g++.dg/cpp0x/scoped_enum_98.C | 4 + gcc/testsuite/g++.dg/cpp0x/scoped_enum_examples.C | 27 + gcc/testsuite/g++.dg/cpp0x/sfinae1.C | 11 + gcc/testsuite/g++.dg/cpp0x/sfinae10.C | 16 + gcc/testsuite/g++.dg/cpp0x/sfinae11.C | 56 + gcc/testsuite/g++.dg/cpp0x/sfinae2.C | 39 + gcc/testsuite/g++.dg/cpp0x/sfinae22.C | 23 + gcc/testsuite/g++.dg/cpp0x/sfinae23.C | 28 + gcc/testsuite/g++.dg/cpp0x/sfinae26.C | 40 + gcc/testsuite/g++.dg/cpp0x/sfinae27.C | 20 + gcc/testsuite/g++.dg/cpp0x/sfinae3.C | 56 + gcc/testsuite/g++.dg/cpp0x/sfinae4.C | 23 + gcc/testsuite/g++.dg/cpp0x/sfinae5.C | 16 + gcc/testsuite/g++.dg/cpp0x/sfinae6.C | 31 + gcc/testsuite/g++.dg/cpp0x/sfinae7.C | 20 + gcc/testsuite/g++.dg/cpp0x/static_assert1.C | 14 + gcc/testsuite/g++.dg/cpp0x/static_assert2.C | 35 + gcc/testsuite/g++.dg/cpp0x/static_assert3.C | 4 + gcc/testsuite/g++.dg/cpp0x/static_assert4.C | 15 + gcc/testsuite/g++.dg/cpp0x/std-layout1.C | 91 ++ gcc/testsuite/g++.dg/cpp0x/syntax-err1.C | 8 + gcc/testsuite/g++.dg/cpp0x/temp-constructor-bug.C | 15 + gcc/testsuite/g++.dg/cpp0x/temp-va-arg-bug.C | 11 + gcc/testsuite/g++.dg/cpp0x/temp_default1.C | 32 + gcc/testsuite/g++.dg/cpp0x/temp_default2.C | 14 + gcc/testsuite/g++.dg/cpp0x/temp_default3.C | 16 + gcc/testsuite/g++.dg/cpp0x/temp_default4.C | 11 + gcc/testsuite/g++.dg/cpp0x/template_deduction.C | 68 + gcc/testsuite/g++.dg/cpp0x/trailing1.C | 117 ++ gcc/testsuite/g++.dg/cpp0x/trailing2.C | 16 + gcc/testsuite/g++.dg/cpp0x/trailing3.C | 63 + gcc/testsuite/g++.dg/cpp0x/trailing4.C | 12 + gcc/testsuite/g++.dg/cpp0x/trailing5.C | 10 + gcc/testsuite/g++.dg/cpp0x/trivial1.C | 86 ++ gcc/testsuite/g++.dg/cpp0x/union1.C | 34 + gcc/testsuite/g++.dg/cpp0x/union2.C | 34 + gcc/testsuite/g++.dg/cpp0x/union3.C | 69 + gcc/testsuite/g++.dg/cpp0x/union4.C | 17 + gcc/testsuite/g++.dg/cpp0x/union5.C | 23 + gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C | 35 + gcc/testsuite/g++.dg/cpp0x/variadic-104.C | 16 + gcc/testsuite/g++.dg/cpp0x/variadic-bind.C | 476 +++++++ gcc/testsuite/g++.dg/cpp0x/variadic-crash1.C | 72 + gcc/testsuite/g++.dg/cpp0x/variadic-crash2.C | 20 + gcc/testsuite/g++.dg/cpp0x/variadic-ex1.C | 4 + gcc/testsuite/g++.dg/cpp0x/variadic-ex10.C | 9 + gcc/testsuite/g++.dg/cpp0x/variadic-ex11.C | 9 + gcc/testsuite/g++.dg/cpp0x/variadic-ex12.C | 8 + gcc/testsuite/g++.dg/cpp0x/variadic-ex13.C | 39 + gcc/testsuite/g++.dg/cpp0x/variadic-ex14.C | 19 + gcc/testsuite/g++.dg/cpp0x/variadic-ex2.C | 8 + gcc/testsuite/g++.dg/cpp0x/variadic-ex3.C | 11 + gcc/testsuite/g++.dg/cpp0x/variadic-ex4.C | 13 + gcc/testsuite/g++.dg/cpp0x/variadic-ex5.C | 7 + gcc/testsuite/g++.dg/cpp0x/variadic-ex6.C | 13 + gcc/testsuite/g++.dg/cpp0x/variadic-ex7.C | 13 + gcc/testsuite/g++.dg/cpp0x/variadic-ex8.C | 18 + gcc/testsuite/g++.dg/cpp0x/variadic-ex9.C | 10 + gcc/testsuite/g++.dg/cpp0x/variadic-function.C | 96 ++ gcc/testsuite/g++.dg/cpp0x/variadic-init.C | 56 + gcc/testsuite/g++.dg/cpp0x/variadic-lambda.C | 79 ++ gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn.C | 50 + gcc/testsuite/g++.dg/cpp0x/variadic-new.C | 19 + gcc/testsuite/g++.dg/cpp0x/variadic-new2.C | 24 + gcc/testsuite/g++.dg/cpp0x/variadic-rref.C | 36 + gcc/testsuite/g++.dg/cpp0x/variadic-throw.C | 26 + gcc/testsuite/g++.dg/cpp0x/variadic-ttp.C | 12 + gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C | 294 ++++ gcc/testsuite/g++.dg/cpp0x/variadic-unify-2.C | 14 + gcc/testsuite/g++.dg/cpp0x/variadic-unify.C | 15 + gcc/testsuite/g++.dg/cpp0x/variadic-unresolved.C | 12 + gcc/testsuite/g++.dg/cpp0x/variadic-value1.C | 24 + gcc/testsuite/g++.dg/cpp0x/variadic1.C | 10 + gcc/testsuite/g++.dg/cpp0x/variadic10.C | 22 + gcc/testsuite/g++.dg/cpp0x/variadic100.C | 15 + gcc/testsuite/g++.dg/cpp0x/variadic101.C | 23 + gcc/testsuite/g++.dg/cpp0x/variadic102.C | 19 + gcc/testsuite/g++.dg/cpp0x/variadic103.C | 14 + gcc/testsuite/g++.dg/cpp0x/variadic105.C | 24 + gcc/testsuite/g++.dg/cpp0x/variadic106.C | 22 + gcc/testsuite/g++.dg/cpp0x/variadic108.C | 10 + gcc/testsuite/g++.dg/cpp0x/variadic109.C | 17 + gcc/testsuite/g++.dg/cpp0x/variadic11.C | 18 + gcc/testsuite/g++.dg/cpp0x/variadic110.C | 15 + gcc/testsuite/g++.dg/cpp0x/variadic111.C | 19 + gcc/testsuite/g++.dg/cpp0x/variadic113.C | 20 + gcc/testsuite/g++.dg/cpp0x/variadic114.C | 27 + gcc/testsuite/g++.dg/cpp0x/variadic115.C | 19 + gcc/testsuite/g++.dg/cpp0x/variadic116.C | 32 + gcc/testsuite/g++.dg/cpp0x/variadic12.C | 42 + gcc/testsuite/g++.dg/cpp0x/variadic13.C | 19 + gcc/testsuite/g++.dg/cpp0x/variadic134.C | 17 + gcc/testsuite/g++.dg/cpp0x/variadic14.C | 21 + gcc/testsuite/g++.dg/cpp0x/variadic15.C | 21 + gcc/testsuite/g++.dg/cpp0x/variadic16.C | 21 + gcc/testsuite/g++.dg/cpp0x/variadic17.C | 21 + gcc/testsuite/g++.dg/cpp0x/variadic18.C | 47 + gcc/testsuite/g++.dg/cpp0x/variadic19.C | 19 + gcc/testsuite/g++.dg/cpp0x/variadic2.C | 17 + gcc/testsuite/g++.dg/cpp0x/variadic20.C | 47 + gcc/testsuite/g++.dg/cpp0x/variadic21.C | 7 + gcc/testsuite/g++.dg/cpp0x/variadic22.C | 21 + gcc/testsuite/g++.dg/cpp0x/variadic23.C | 25 + gcc/testsuite/g++.dg/cpp0x/variadic24.C | 6 + gcc/testsuite/g++.dg/cpp0x/variadic25.C | 16 + gcc/testsuite/g++.dg/cpp0x/variadic26.C | 24 + gcc/testsuite/g++.dg/cpp0x/variadic27.C | 22 + gcc/testsuite/g++.dg/cpp0x/variadic28.C | 25 + gcc/testsuite/g++.dg/cpp0x/variadic29.C | 35 + gcc/testsuite/g++.dg/cpp0x/variadic3.C | 10 + gcc/testsuite/g++.dg/cpp0x/variadic30.C | 11 + gcc/testsuite/g++.dg/cpp0x/variadic31.C | 11 + gcc/testsuite/g++.dg/cpp0x/variadic32.C | 11 + gcc/testsuite/g++.dg/cpp0x/variadic33.C | 16 + gcc/testsuite/g++.dg/cpp0x/variadic34.C | 11 + gcc/testsuite/g++.dg/cpp0x/variadic35.C | 10 + gcc/testsuite/g++.dg/cpp0x/variadic36.C | 15 + gcc/testsuite/g++.dg/cpp0x/variadic37.C | 10 + gcc/testsuite/g++.dg/cpp0x/variadic38.C | 6 + gcc/testsuite/g++.dg/cpp0x/variadic39.C | 13 + gcc/testsuite/g++.dg/cpp0x/variadic4.C | 15 + gcc/testsuite/g++.dg/cpp0x/variadic40.C | 3 + gcc/testsuite/g++.dg/cpp0x/variadic41.C | 14 + gcc/testsuite/g++.dg/cpp0x/variadic42.C | 12 + gcc/testsuite/g++.dg/cpp0x/variadic43.C | 8 + gcc/testsuite/g++.dg/cpp0x/variadic44.C | 13 + gcc/testsuite/g++.dg/cpp0x/variadic45.C | 10 + gcc/testsuite/g++.dg/cpp0x/variadic46.C | 11 + gcc/testsuite/g++.dg/cpp0x/variadic47.C | 18 + gcc/testsuite/g++.dg/cpp0x/variadic48.C | 10 + gcc/testsuite/g++.dg/cpp0x/variadic49.C | 9 + gcc/testsuite/g++.dg/cpp0x/variadic5.C | 38 + gcc/testsuite/g++.dg/cpp0x/variadic50.C | 9 + gcc/testsuite/g++.dg/cpp0x/variadic51.C | 10 + gcc/testsuite/g++.dg/cpp0x/variadic52.C | 7 + gcc/testsuite/g++.dg/cpp0x/variadic53.C | 17 + gcc/testsuite/g++.dg/cpp0x/variadic54.C | 12 + gcc/testsuite/g++.dg/cpp0x/variadic55.C | 12 + gcc/testsuite/g++.dg/cpp0x/variadic56.C | 19 + gcc/testsuite/g++.dg/cpp0x/variadic57.C | 16 + gcc/testsuite/g++.dg/cpp0x/variadic58.C | 16 + gcc/testsuite/g++.dg/cpp0x/variadic59.C | 4 + gcc/testsuite/g++.dg/cpp0x/variadic6.C | 12 + gcc/testsuite/g++.dg/cpp0x/variadic60.C | 1 + gcc/testsuite/g++.dg/cpp0x/variadic61.C | 2 + gcc/testsuite/g++.dg/cpp0x/variadic62.C | 2 + gcc/testsuite/g++.dg/cpp0x/variadic63.C | 2 + gcc/testsuite/g++.dg/cpp0x/variadic64.C | 19 + gcc/testsuite/g++.dg/cpp0x/variadic65.C | 8 + gcc/testsuite/g++.dg/cpp0x/variadic66.C | 9 + gcc/testsuite/g++.dg/cpp0x/variadic67.C | 24 + gcc/testsuite/g++.dg/cpp0x/variadic68.C | 23 + gcc/testsuite/g++.dg/cpp0x/variadic69.C | 34 + gcc/testsuite/g++.dg/cpp0x/variadic7.C | 33 + gcc/testsuite/g++.dg/cpp0x/variadic70.C | 22 + gcc/testsuite/g++.dg/cpp0x/variadic71.C | 12 + gcc/testsuite/g++.dg/cpp0x/variadic72.C | 21 + gcc/testsuite/g++.dg/cpp0x/variadic73.C | 33 + gcc/testsuite/g++.dg/cpp0x/variadic74.C | 26 + gcc/testsuite/g++.dg/cpp0x/variadic75.C | 33 + gcc/testsuite/g++.dg/cpp0x/variadic76.C | 13 + gcc/testsuite/g++.dg/cpp0x/variadic77.C | 22 + gcc/testsuite/g++.dg/cpp0x/variadic78.C | 23 + gcc/testsuite/g++.dg/cpp0x/variadic79.C | 7 + gcc/testsuite/g++.dg/cpp0x/variadic8.C | 23 + gcc/testsuite/g++.dg/cpp0x/variadic80.C | 28 + gcc/testsuite/g++.dg/cpp0x/variadic81.C | 11 + gcc/testsuite/g++.dg/cpp0x/variadic82.C | 11 + gcc/testsuite/g++.dg/cpp0x/variadic83.C | 8 + gcc/testsuite/g++.dg/cpp0x/variadic84.C | 26 + gcc/testsuite/g++.dg/cpp0x/variadic85.C | 10 + gcc/testsuite/g++.dg/cpp0x/variadic86.C | 19 + gcc/testsuite/g++.dg/cpp0x/variadic87.C | 23 + gcc/testsuite/g++.dg/cpp0x/variadic88.C | 23 + gcc/testsuite/g++.dg/cpp0x/variadic89.C | 14 + gcc/testsuite/g++.dg/cpp0x/variadic9.C | 38 + gcc/testsuite/g++.dg/cpp0x/variadic90.C | 8 + gcc/testsuite/g++.dg/cpp0x/variadic91.C | 17 + gcc/testsuite/g++.dg/cpp0x/variadic92.C | 70 + gcc/testsuite/g++.dg/cpp0x/variadic93.C | 11 + gcc/testsuite/g++.dg/cpp0x/variadic94.C | 33 + gcc/testsuite/g++.dg/cpp0x/variadic95.C | 17 + gcc/testsuite/g++.dg/cpp0x/variadic96.C | 26 + gcc/testsuite/g++.dg/cpp0x/variadic97.C | 35 + gcc/testsuite/g++.dg/cpp0x/variadic98.C | 411 ++++++ gcc/testsuite/g++.dg/cpp0x/variadic99.C | 22 + gcc/testsuite/g++.dg/cpp0x/vt-33964.C | 20 + gcc/testsuite/g++.dg/cpp0x/vt-34050.C | 9 + gcc/testsuite/g++.dg/cpp0x/vt-34051-2.C | 7 + gcc/testsuite/g++.dg/cpp0x/vt-34051.C | 12 + gcc/testsuite/g++.dg/cpp0x/vt-34052.C | 8 + gcc/testsuite/g++.dg/cpp0x/vt-34055.C | 31 + gcc/testsuite/g++.dg/cpp0x/vt-34102.C | 7 + gcc/testsuite/g++.dg/cpp0x/vt-34103.C | 7 + gcc/testsuite/g++.dg/cpp0x/vt-34219-2.C | 22 + gcc/testsuite/g++.dg/cpp0x/vt-34219.C | 15 + gcc/testsuite/g++.dg/cpp0x/vt-34314.C | 50 + gcc/testsuite/g++.dg/cpp0x/vt-34399.C | 10 + gcc/testsuite/g++.dg/cpp0x/vt-34606.C | 9 + gcc/testsuite/g++.dg/cpp0x/vt-34751.C | 19 + gcc/testsuite/g++.dg/cpp0x/vt-34753.C | 14 + gcc/testsuite/g++.dg/cpp0x/vt-34754.C | 6 + gcc/testsuite/g++.dg/cpp0x/vt-34755.C | 6 + gcc/testsuite/g++.dg/cpp0x/vt-34919.C | 13 + gcc/testsuite/g++.dg/cpp0x/vt-34961.C | 7 + gcc/testsuite/g++.dg/cpp0x/vt-35023.C | 11 + gcc/testsuite/g++.dg/cpp0x/vt-35024.C | 11 + gcc/testsuite/g++.dg/cpp0x/vt-35026.C | 7 + gcc/testsuite/g++.dg/cpp0x/vt-35147.C | 18 + gcc/testsuite/g++.dg/cpp0x/vt-35242.C | 7 + gcc/testsuite/g++.dg/cpp0x/vt-35243.C | 9 + gcc/testsuite/g++.dg/cpp0x/vt-35331.C | 7 + gcc/testsuite/g++.dg/cpp0x/vt-37737-1.C | 12 + gcc/testsuite/g++.dg/cpp0x/vt-37737-2.C | 16 + gcc/testsuite/g++.dg/cpp0x/vt-40092.C | 21 + gcc/testsuite/g++.dg/cpp0x/warn_cxx0x.C | 9 + 787 files changed, 27896 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/__func__.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/access01.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/alignof.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/alignof2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto11.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto14.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto15.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto16.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto17.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto18.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto19.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto20.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto21.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto22.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto23.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto31.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/auto9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/bind.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/bracket1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/bracket2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/bracket3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/bracket4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/cast-bug.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/cast.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/collapse-bug.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/collapse.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-46420.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-47570.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-98.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-access.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array-tparm.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-attribute.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-auto.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-base.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-base2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-base3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-base4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-cleanup.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-complex.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ctor.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ctor2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ctor3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ctor4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ctor5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ctor6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ctor7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ctor8.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ctor9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-data1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-decl.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-defarg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-delete.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-deref.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-diag2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-eh-spec.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ellipsis.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ellipsis2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-empty.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-empty2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-empty3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-empty4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-empty5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ex2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ex4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-expinst.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-explicit-inst.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-fnptr.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-friend.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-function1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-function3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ice2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ice3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-initlist.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-initlist2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-initlist3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-initlist5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-is_literal.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-missing.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-nonlit.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-nonlit2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-nonstatic.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-object1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-object2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-overflow.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-pos1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-potential1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ptrmem.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-pure.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-sassert.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-static.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-static2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-static4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-static5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-static6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-static7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-stmtexpr.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-string.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-switch.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-synth1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-targ.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-typeid.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-union.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-value.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-value2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-value3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-variadic.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-virtual.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype-33837.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype-33838.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype-38655.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype-refbug.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype11.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype12.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype13.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype14.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype15.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype16.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype17.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype18.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype19.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype20.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype22.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype23.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype24.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype25.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype27.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype30.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype31.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype35.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype36.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype8.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/deduce.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted11.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted13.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted14.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted15.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted16.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted17.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted18.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted19.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted20.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted21.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted24.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted26.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted27.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted29.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted30.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted32.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted8.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/dependent1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/elision.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/elision2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/elision_neg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/elision_weak.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum13.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum15.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum16.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum18.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum19.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum8.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum_base.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum_base_warn.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/error1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/error2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/error3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/error4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/error6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/explicit1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/explicit2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/explicit3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/explicit4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/explicit5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/extern_template-1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/extern_template-2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/extern_template-3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/fntmpdefarg2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum8.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit-copy.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit-trivial1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit8.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-49216.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-array2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-opt.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist11.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist12.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist13.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist14.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist15.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist16.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist17.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist18.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist19.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist20.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist21.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist22.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist23.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist24.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist25.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist26.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist27.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist28.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist29.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist30.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist31.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist32.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist33.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist34.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist35.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist36.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist37.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist38.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist39.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist40.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist41.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist42.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist43.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist44.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist45.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist46.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist47.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist48.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist50.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist51.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist57.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist8.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/inline-ns1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/inline-ns2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/inline-ns3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/inline-ns4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/inline-ns5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/iop.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-50220.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-98.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-const-ref-neg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-const-ref.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const-neg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-default-neg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-default.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-neg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctors.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-debug.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-neg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-direct-init.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-field-names.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class-neg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-init.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-lookup-neg.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mixed.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ns-scope.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-pass.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-recursive.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref-default.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-std-function.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-type.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-uneval.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/linkage2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/long_long.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/move1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/named.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/named_refs.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept01.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept02.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept03.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept04.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept05.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept06.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept07.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept08.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept09.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept11.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nolinkage1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nolinkage1.h create mode 100644 gcc/testsuite/g++.dg/cpp0x/nolinkage1a.cc create mode 100644 gcc/testsuite/g++.dg/cpp0x/not_special.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr01.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr02.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr03.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr04.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr05.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr06.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr07.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr08.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr09.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr11.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr12.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr13.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr14.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr15.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr16.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr17.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr18.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr19.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr20.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr21.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr22.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/nullptr28.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/overload-conv-1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/overload-conv-2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/overload.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/overloadn.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/parse1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31431-2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31431.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31432.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31434.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31437.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31438.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31439.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31442.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31443.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31444.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31445.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr31993.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr32114.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr32115.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr32125.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr32126.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr32127.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr32128.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr32252.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr32253.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr32566.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr33839.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr33930.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr33955.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr33996.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr34054.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr34056.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr34057.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr34058.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr34060.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr34061.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr38646.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr38795.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr39639.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr42844-2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr45908.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr47416.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr47476.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr48522.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr50491.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr50901.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr51150.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for8.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/range-for9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/reference_collapsing.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/49290.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/README create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/abi-empty7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/array1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/bitfield-err1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/call1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/condition1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/debug-debug7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/enum1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/ext-cond1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/ext-label10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/isnan.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/no-elide1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/non-const1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/parse-ambig5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/regress1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/regress2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/regress3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/regress5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/template-const1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/template-const2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/template-function1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/value-dep1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-bitfield.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-bitfield2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-cast.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-cast2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-cast3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-cast4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-deduce.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-deduce2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-lvalue-req.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-reinterpret.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-restrict.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-return.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv1n.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv1p.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv2n.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv2p.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv3n.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv3p.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv4n.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv4p.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv5n.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv5p.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv6n.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv6p.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv7n.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv7p.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv8p.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv9p.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/rvo.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/scoped_enum.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/scoped_enum2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/scoped_enum_98.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/scoped_enum_examples.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae11.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae22.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae23.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae26.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae27.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/static_assert1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/static_assert2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/static_assert3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/static_assert4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/std-layout1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/syntax-err1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/temp-constructor-bug.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/temp-va-arg-bug.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/temp_default1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/temp_default2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/temp_default3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/temp_default4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/template_deduction.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/trailing1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/trailing2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/trailing3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/trailing4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/trailing5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/trivial1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/union1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/union2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/union3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/union4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/union5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-104.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-bind.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-crash1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-crash2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex11.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex12.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex13.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex14.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex8.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ex9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-function.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-init.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-lambda.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-new.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-new2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-rref.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-throw.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ttp.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-unify-2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-unify.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-unresolved.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-value1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic100.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic101.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic102.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic103.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic105.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic106.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic108.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic109.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic11.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic110.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic111.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic113.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic114.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic115.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic116.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic12.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic13.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic134.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic14.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic15.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic16.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic17.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic18.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic19.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic20.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic21.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic22.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic23.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic24.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic25.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic26.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic27.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic28.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic29.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic3.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic30.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic31.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic32.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic33.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic34.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic35.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic36.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic37.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic38.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic39.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic40.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic41.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic42.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic43.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic44.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic45.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic46.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic47.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic48.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic49.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic5.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic50.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic51.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic52.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic53.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic54.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic55.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic56.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic57.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic58.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic59.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic60.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic61.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic62.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic63.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic64.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic65.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic66.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic67.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic68.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic69.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic70.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic71.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic72.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic73.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic74.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic75.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic76.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic77.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic78.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic79.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic8.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic80.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic81.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic82.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic83.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic84.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic85.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic86.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic87.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic88.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic89.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic9.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic90.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic91.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic92.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic93.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic94.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic95.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic96.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic97.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic98.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic99.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-33964.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34050.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34051-2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34051.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34052.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34055.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34102.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34103.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34219-2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34219.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34314.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34399.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34606.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34751.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34753.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34754.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34755.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34919.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-34961.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-35023.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-35024.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-35026.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-35147.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-35242.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-35243.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-35331.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-37737-1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-37737-2.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-40092.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/warn_cxx0x.C (limited to 'gcc/testsuite/g++.dg/cpp0x') diff --git a/gcc/testsuite/g++.dg/cpp0x/__func__.C b/gcc/testsuite/g++.dg/cpp0x/__func__.C new file mode 100644 index 000000000..1ac906515 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/__func__.C @@ -0,0 +1,6 @@ +// { dg-options "-std=c++0x -pedantic" } + +const char* foo() +{ + return __func__; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/access01.C b/gcc/testsuite/g++.dg/cpp0x/access01.C new file mode 100644 index 000000000..43e5e8637 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/access01.C @@ -0,0 +1,15 @@ +// PR c++/49042 +// { dg-options -std=c++0x } + +template +class A +{ + T p; +public: + template auto f() -> decltype(+p) { } +}; + +int main() +{ + A().f(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/alignof.C b/gcc/testsuite/g++.dg/cpp0x/alignof.C new file mode 100644 index 000000000..8e8f715cd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alignof.C @@ -0,0 +1,5 @@ +// { dg-options "-std=c++0x" } +int main(void) +{ + static_assert(alignof(int) == __alignof(int), "alignof(int) does not equal __alignof(int)"); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/alignof2.C b/gcc/testsuite/g++.dg/cpp0x/alignof2.C new file mode 100644 index 000000000..7c5aad3de --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alignof2.C @@ -0,0 +1,7 @@ +// { dg-do compile } +// { dg-options "-std=c++0x -pedantic" } +int main(void) +{ + alignof(int); //ok with a type but not with an expression + alignof(3); // { dg-warning "alignof" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto1.C b/gcc/testsuite/g++.dg/cpp0x/auto1.C new file mode 100644 index 000000000..9e274b622 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto1.C @@ -0,0 +1,8 @@ +// { dg-options "-std=c++98 -Wc++0x-compat" } + +// Test warning for use of auto in C++98 mode with C++0x +// compatibility warnings +void f() +{ + auto int x = 5; // { dg-warning "will change meaning" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto10.C b/gcc/testsuite/g++.dg/cpp0x/auto10.C new file mode 100644 index 000000000..9b89291d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto10.C @@ -0,0 +1,22 @@ +// Positive test for auto +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include +extern "C" void abort(); + +int main() +{ + if (auto i = 42L) + { + if (typeid (i) != typeid (long int)) + abort (); + } + + while (auto i = 1) + { + if (typeid (i) != typeid (int)) + abort (); + break; + } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto11.C b/gcc/testsuite/g++.dg/cpp0x/auto11.C new file mode 100644 index 000000000..bd21daef0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto11.C @@ -0,0 +1,12 @@ +// PR c++/38256 +// { dg-options "-std=c++0x" } + +template struct A +{ + template operator T(); +}; + +void foo() +{ + A<0>().operator auto(); // { dg-error "auto.*conversion" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto14.C b/gcc/testsuite/g++.dg/cpp0x/auto14.C new file mode 100644 index 000000000..cb2c4e035 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto14.C @@ -0,0 +1,29 @@ +// PR c++/40306, c++/40307 +// { dg-options "-std=c++0x" } +// { dg-do run } + +template< typename T > +struct test { + test run() { + auto tmp = *this; + return tmp; + } + test run_pass() { + test tmp( *this ); + return tmp; + } + + test run_fail() { + auto tmp( *this ); + return tmp; + } +}; + +int main() +{ + test x; + x.run(); + x.run_pass(); + x.run_fail(); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto15.C b/gcc/testsuite/g++.dg/cpp0x/auto15.C new file mode 100644 index 000000000..b23e1e2fd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto15.C @@ -0,0 +1,13 @@ +// { dg-options "-std=c++0x" } + +template< typename Fn > struct function; + +template< typename Result, typename ... ArgTypes > +struct function< auto (ArgTypes...)->Result > { +}; + +int main() +{ + function< auto(double)->int > y; + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto16.C b/gcc/testsuite/g++.dg/cpp0x/auto16.C new file mode 100644 index 000000000..1b4ae8f82 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto16.C @@ -0,0 +1,7 @@ +// PR c++/40619 +// { dg-options "-std=c++0x" } + +template struct X {}; + +template auto f(T t) -> X {} +template auto g(T t) -> X {} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto17.C b/gcc/testsuite/g++.dg/cpp0x/auto17.C new file mode 100644 index 000000000..03608d33a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto17.C @@ -0,0 +1,10 @@ +// PR c++/42567 +// { dg-options "-std=c++0x" } + +template +struct A { + template + void fn(C c) { + auto& key = *c; + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/auto18.C b/gcc/testsuite/g++.dg/cpp0x/auto18.C new file mode 100644 index 000000000..17f7f9959 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto18.C @@ -0,0 +1,6 @@ +// { dg-options "-std=c++0x" } + +void f() +{ + auto val = val; // { dg-error "auto. type used in its own initializer" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto19.C b/gcc/testsuite/g++.dg/cpp0x/auto19.C new file mode 100644 index 000000000..f70990287 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto19.C @@ -0,0 +1,8 @@ +// { dg-options -std=c++0x } + +struct Explicit { + Explicit() = default; // Line 2 + explicit Explicit(const Explicit&){} +} ex; + +auto ex2(ex); // Line 6 diff --git a/gcc/testsuite/g++.dg/cpp0x/auto2.C b/gcc/testsuite/g++.dg/cpp0x/auto2.C new file mode 100644 index 000000000..626e9e245 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto2.C @@ -0,0 +1,74 @@ +// Positive test for auto +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include +extern "C" void abort(); + +int f() {} + +struct A +{ + int i; + int f() {} + A operator+(A a) { return a; } +}; + +template +void g(T t) +{ + auto x = t+t; + if (typeid(x) != typeid(t+t)) + abort(); + + auto p = new auto(&t); + if (typeid(p) != typeid(T**)) + abort(); +} + +int main() +{ + auto i = 42; + if (typeid (i) != typeid (int)) + abort(); + + auto *p = &i; + if (typeid (p) != typeid (int*)) + abort(); + + auto *p2 = &p; + if (typeid (p2) != typeid (int**)) + abort(); + + auto (*fp)() = f; + if (typeid (fp) != typeid (int (*)())) + abort(); + + auto A::* pm = &A::i; + if (typeid (pm) != typeid (int A::*)) + abort(); + + auto (A::*pmf)() = &A::f; + if (typeid (pmf) != typeid (int (A::*)())) + abort(); + + g(42); + g(10.f); + g(A()); + + auto *p3 = new auto (i); + if (typeid (p3) != typeid (int*)) + abort(); + + for (auto idx = i; idx != 0; idx = 0); + while (auto idx = 0); + if (auto idx = 1); + + switch (auto s = i) + { + case 42: + break; + } + + auto j = 42, k = 24; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto20.C b/gcc/testsuite/g++.dg/cpp0x/auto20.C new file mode 100644 index 000000000..90f875114 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto20.C @@ -0,0 +1,20 @@ +// Test for proper non-deduced context handling of the initializer +// for an auto declaration/new. +// { dg-options -std=c++0x } + +struct with_apply +{ + template + void apply(const double&){} +}; + +auto p = &with_apply::apply<0>; +auto pp = new auto(&with_apply::apply<0>); + +template +void f() +{ + auto p = &T::template apply<0>; +} + +template void f(); diff --git a/gcc/testsuite/g++.dg/cpp0x/auto21.C b/gcc/testsuite/g++.dg/cpp0x/auto21.C new file mode 100644 index 000000000..1cbcac58d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto21.C @@ -0,0 +1,5 @@ +// Origin PR c++/47208 +// { dg-options "-std=c++0x" } + +constexpr auto list = { }; // { dg-error "deducing from brace-enclosed initializer list requires #include " } +static const int l = list.size(); diff --git a/gcc/testsuite/g++.dg/cpp0x/auto22.C b/gcc/testsuite/g++.dg/cpp0x/auto22.C new file mode 100644 index 000000000..66630e536 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto22.C @@ -0,0 +1,21 @@ +// PR c++/47999 +// { dg-options -std=c++0x } + +int& identity(int& i) +{ + return i; +} + +// In a function template, auto type deduction works incorrectly. +template +void f() +{ + int i = 0; + auto&& x = identity(i); // Type of x should be `int&`, but it is `int&&`. +} + +int main (int argc, char* argv[]) +{ + f(); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto23.C b/gcc/testsuite/g++.dg/cpp0x/auto23.C new file mode 100644 index 000000000..49b5a0eb9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto23.C @@ -0,0 +1,4 @@ +// PR c++/46245 +// { dg-options -std=c++0x } + +templateint> struct A { }; diff --git a/gcc/testsuite/g++.dg/cpp0x/auto3.C b/gcc/testsuite/g++.dg/cpp0x/auto3.C new file mode 100644 index 000000000..860790d7d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto3.C @@ -0,0 +1,27 @@ +// Negative test for auto +// { dg-options "-std=c++0x" } + +#include + +auto x; // { dg-error "auto" } + +// If the type deduced for the template parameter U is not the same in each +// deduction, the program is ill-formed. +auto i = 42, j = 42.0; // { dg-error "auto" } + +// New CWG issue +auto a[2] = { 1, 2 }; // { dg-error "initializer_list" } + +template +struct A { }; + +A A1; +// CWG issue 625 +A A2 = A1; // { dg-error "" } + +auto foo() { } // { dg-error "auto" } + +void bar(auto i) // { dg-error "incomplete|auto" } +{ + (void)i; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto31.C b/gcc/testsuite/g++.dg/cpp0x/auto31.C new file mode 100644 index 000000000..2c74b72df --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto31.C @@ -0,0 +1,12 @@ +// PR c++/51416 +// { dg-options "-std=c++0x" } + +template void foo(T, U... u) +{ + auto foo(u...); // { dg-error "auto" } +} + +void bar() +{ + foo(0); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto4.C b/gcc/testsuite/g++.dg/cpp0x/auto4.C new file mode 100644 index 000000000..d47bca436 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto4.C @@ -0,0 +1,28 @@ +// Testcase for deduction of std::initializer_list for auto. +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include +#include +extern "C" void abort(); + +template +void f (T t) +{ + auto ilt = { &t, &t }; + if (typeid(ilt) != typeid(std::initializer_list)) + abort(); + + auto il = { 1, 2, 3 }; + if (typeid(il) != typeid(std::initializer_list)) + abort(); +} + +int main() +{ + auto il = { 1, 2, 3 }; + if (typeid(il) != typeid(std::initializer_list)) + abort(); + + f('c'); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto5.C b/gcc/testsuite/g++.dg/cpp0x/auto5.C new file mode 100644 index 000000000..ebe2df22e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto5.C @@ -0,0 +1,22 @@ +// Testcase for non-dependent auto in templates +// { dg-options "-std=c++0x" } + +struct A +{ + template void f(); +} a; + +template +void g() +{ + auto aa = a; + aa.f(); + + auto p = new auto (a); + p->f(); +} + +int main() +{ + g(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/auto7.C b/gcc/testsuite/g++.dg/cpp0x/auto7.C new file mode 100644 index 000000000..9ef5a80eb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto7.C @@ -0,0 +1,13 @@ +// PR c++/37965 +// Negative test for auto +// { dg-options "-std=c++0x" } + +auto i = 6; +auto j; // { dg-error "has no initializer" } + +template struct A +{ + static auto k = 7; + static auto l; // { dg-error "has no initializer" } + auto m; // { dg-error "has no initializer" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/auto9.C b/gcc/testsuite/g++.dg/cpp0x/auto9.C new file mode 100644 index 000000000..190bfa6e8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto9.C @@ -0,0 +1,124 @@ +// PR c++/37962 +// Negative test for auto +// { dg-do compile } +// { dg-options "-std=c++0x" } + +#include +#include +#include + +int i = *(auto *) 0; // { dg-error "auto" } +struct A *p = (auto *) 0; // { dg-error "auto" } +int *q = static_cast (0); // { dg-error "auto" } +const int *r = const_cast (q); // { dg-error "auto" } +const std::type_info &t1 = typeid (auto); // { dg-error "auto" } +const std::type_info &t2 = typeid (auto *); // { dg-error "auto" } + +struct A +{ + operator auto (); // { dg-error "auto" } + operator auto *(); // { dg-error "auto" } +}; + +struct A2 +{ + operator auto () -> int; // { dg-error "invalid use of" } + operator auto *() -> int; // { dg-error "auto" } +}; + +template struct B +{ + enum { e }; +}; + +template struct C +{ + C () : i () {} + int i; +}; + +bool d = (auto (A::*)()) 0; // { dg-error "auto" } + +void +foo () +{ + (auto) { 0 }; // { dg-error "auto" } + C c; + dynamic_cast (c); // { dg-error "auto" } + reinterpret_cast (c); // { dg-error "auto" } + int i = auto (0); // { dg-error "auto" } + auto p1 = new (auto); // { dg-error "auto" } + auto p2 = new (auto) (42); // { dg-error "invalid use of|deduce" } + offsetof (auto, fld); // { dg-error "auto" } + offsetof (auto *, fld); // { dg-error "auto" } + sizeof (auto); // { dg-error "auto" } + sizeof (auto *); // { dg-error "auto" } +} + +void +foo2 (void) +{ + __alignof__ (auto); // { dg-error "auto" } + __alignof__ (auto *); // { dg-error "auto" } + __typeof__ (auto) v1; // { dg-error "auto" } + __typeof__ (auto *) v2; // { dg-error "auto" } + __is_class (auto); // { dg-error "auto|expected" } + __is_pod (auto *); // { dg-error "auto|expected" } + __is_base_of (int, auto); // { dg-error "auto|expected" } + __is_base_of (auto, int); // { dg-error "auto|expected" } + __is_base_of (auto, auto *); // { dg-error "auto|expected" } +} + +B b; // { dg-error "auto|invalid" } +C c; // { dg-error "auto|invalid" } +C c2; // { dg-error "auto|invalid" } + +enum : auto { EE = 0 }; // { dg-error "must be an integral type" } +enum struct D : auto * { FF = 0 }; // { dg-error "must be an integral type|declar|expected" } + +void +bar () +{ + try { } catch (auto i) { } // { dg-error "parameter declared" } + try { } catch (auto) { } // { dg-error "parameter declared" } + try { } catch (auto *i) { } // { dg-error "parameter declared" } + try { } catch (auto *) { } // { dg-error "parameter declared" } +} + +void +baz (int i, ...) +{ + va_list ap; + va_start (ap, i); + va_arg (ap, auto); // { dg-error "invalid use of" } + va_arg (ap, auto *); // { dg-error "invalid use of|expected" } + va_arg (ap, auto &); // { dg-error "invalid use of|expected" } + va_end (ap); +} + +template struct E {}; // { dg-error "invalid use of" } +template struct F {}; // { dg-error "invalid use of|expected" } + +auto fnlate () -> auto; // { dg-error "invalid use of" } +auto fnlate2 () -> auto *; // { dg-error "invalid use of|expected" } + +void +badthrow () throw (auto) // { dg-error "invalid use of" } +{ +} + +void +badthrow2 () throw (auto &) // { dg-error "invalid use of|expected" } +{ +} + +template struct G {}; // { dg-error "auto" } + +template struct H { H (); ~H (); }; +H h; // { dg-error "invalid" } + +void qq (auto); // { dg-error "auto" } +void qr (auto*); // { dg-error "auto" } + +// PR c++/46145 +typedef auto autot; // { dg-error "auto" } diff --git a/gcc/testsuite/g++.dg/cpp0x/bind.C b/gcc/testsuite/g++.dg/cpp0x/bind.C new file mode 100644 index 000000000..42a2ac203 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/bind.C @@ -0,0 +1,8 @@ +// { dg-options "--std=c++0x" } +struct S{}; +void f(S&&); + +int main() +{ + f(S()); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/bracket1.C b/gcc/testsuite/g++.dg/cpp0x/bracket1.C new file mode 100644 index 000000000..dfb5bf4ea --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/bracket1.C @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +template +struct list {}; + +template +struct vector { + operator T() const; +}; + +void f() +{ + vector> v; + const vector vi = static_cast>(v); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/bracket2.C b/gcc/testsuite/g++.dg/cpp0x/bracket2.C new file mode 100644 index 000000000..300015d01 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/bracket2.C @@ -0,0 +1,11 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +template class X { /* ... */ }; +X< 1>2 > x1; // // { dg-error "numeric constant" } +X<(1>2)> x2; // Okay. + +template class Y { /* ... */ }; +Y> x3; // Okay, same as "Y > x3;". +Y>1>> x4; // { dg-error "numeric constant" } +Y>1)>> x5; // Okay diff --git a/gcc/testsuite/g++.dg/cpp0x/bracket3.C b/gcc/testsuite/g++.dg/cpp0x/bracket3.C new file mode 100644 index 000000000..4ef7a0e9d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/bracket3.C @@ -0,0 +1,10 @@ +// { dg-options "-std=c++98 -Wc++0x-compat" } + +template struct X {}; + +X<1 >> 2> x; // { dg-warning "will be treated as|suggest parentheses" } + +// From cp/parser.c +typedef int Y; +template struct Foo {}; +Foo> 5> r; // { dg-warning "will be treated as|suggest parentheses" } diff --git a/gcc/testsuite/g++.dg/cpp0x/bracket4.C b/gcc/testsuite/g++.dg/cpp0x/bracket4.C new file mode 100644 index 000000000..0e1985cef --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/bracket4.C @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +template +struct vector { +}; + +struct X { + template + struct tmpl { + operator T() const; + }; +}; + +template +void g() +{ + T::template tmpl>() + 2; +} + +template +void operator+(vector, int); + +void f() +{ + vector>() + 2; +} + +// PR c++/36460 +template +class A {}; +template +class B {}; + +A> x; + diff --git a/gcc/testsuite/g++.dg/cpp0x/cast-bug.C b/gcc/testsuite/g++.dg/cpp0x/cast-bug.C new file mode 100644 index 000000000..211f88b2b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/cast-bug.C @@ -0,0 +1,14 @@ +// { dg-options "--std=c++0x" } +struct S +{ + S(); + S(S &&); +private: + S(S &); +}; + +S f() +{ + S s; + return static_cast(s); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/cast.C b/gcc/testsuite/g++.dg/cpp0x/cast.C new file mode 100644 index 000000000..9162d09f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/cast.C @@ -0,0 +1,30 @@ +// I, Howard Hinnant, hereby place this code in the public domain. + +// Test cast from lvalue to rvalue + +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template struct sa; +template <> struct sa {}; + +struct one {long x[1];}; +struct two {long x[2];}; + +struct A {}; + +one foo(const A&) {return one();} +two foo(A&&) {return two();} + +int test1() +{ + A a; + sa t1; + sa(a))) == 2 * sizeof(long)> t2; + return 0; +} + +int main() +{ + return test1(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/collapse-bug.C b/gcc/testsuite/g++.dg/cpp0x/collapse-bug.C new file mode 100644 index 000000000..02a59cd1d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/collapse-bug.C @@ -0,0 +1,16 @@ +// { dg-options "--std=c++0x" } +template struct same_type; +template struct same_type {}; + +template +struct S +{ + typedef T const (&type)(); +}; + +void f() +{ + // initial implementation didn't ignore const qualifier on + // reference, resulting in a typedef of 'const int& (&)()' + same_type::type, int&(&)()>(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/collapse.C b/gcc/testsuite/g++.dg/cpp0x/collapse.C new file mode 100644 index 000000000..96c327324 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/collapse.C @@ -0,0 +1,38 @@ +// { dg-options "--std=c++0x" } +template struct same_type; +template struct same_type {}; + +typedef int & lref; +typedef int const & clref; +typedef int && rref; +typedef int const && crref; + +template +struct S +{ + typedef T & lref; + typedef T const & clref; + typedef T && rref; + typedef T const && crref; +}; + +void f() +{ + same_type(); + same_type(); + same_type(); + same_type(); + + same_type(); + same_type(); + same_type(); + + same_type::lref &, int &>(); + same_type::lref &&, int &>(); + same_type::rref &, int &>(); + same_type::rref &&, int &&>(); + + same_type::rref, int const &>(); + same_type::crref, int volatile &&>(); + same_type::clref, int const &>(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-46420.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-46420.C new file mode 100644 index 000000000..757a6e315 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-46420.C @@ -0,0 +1,13 @@ +// PR c++/46420 +// { dg-options -std=c++0x } + +template class vector { }; +struct A{}; +template +void complete_test(vector data1){ + A drop=A(); +} +int main(){ + vector vect1; + complete_test(vect1); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-47570.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-47570.C new file mode 100644 index 000000000..c60ba8658 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-47570.C @@ -0,0 +1,25 @@ +// PR c++/47570 +// { dg-options -std=c++0x } + +unsigned int constexpr one() +{ return 1; } + +int constexpr one_B() +{ return 1; } + +int main() +{ + // FAIL TO COMPILE: + static bool constexpr SC_huh1 = ((unsigned int)one()) >= ((unsigned int)0); + static bool constexpr SC_huh2 = one() >= ((unsigned int)0); + static bool constexpr SC_huh3 = one() >= 0; + + // COMPILE OK: + static bool constexpr SC_huh4 = ((one() == 0) || (one() > 0)); + static bool constexpr SC_huh5 = one() == 0; + static bool constexpr SC_huh6 = one() > 0; + static bool constexpr SC_huh7 = one_B() >= 0; + static bool constexpr SC_huh8 = one() >= 1; + + return SC_huh3; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C new file mode 100644 index 000000000..5124f7c7f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C @@ -0,0 +1,50 @@ +// PR c++/48089 +// { dg-options -std=c++0x } + +// bang is ill-formed (diagnostic required) because its initializer is +// non-constant, because it uses the value of an uninitialized object. + +// s() is ill-formed (no diagnostic required) because there is no set of +// arguments that would produce a constant expression. + +// R() is well-formed because i is initialized before j. + +struct s { + constexpr s() : v(v) { } // { dg-message "" } + int v; +}; + +constexpr s bang; // { dg-error "" } + +struct R { + int i,j; + constexpr R() : i(42),j(i) { } // { dg-bogus "" "" { xfail *-*-* } } +}; + +constexpr R r; // { dg-bogus "" "" { xfail *-*-* } } + +// Ill-formed (no diagnostic required) +struct T { + int i; + constexpr int f() { return i; } + constexpr T(): i(0) { } + constexpr T(const T& t) : i(f()) { } // { dg-message "" } +}; + +constexpr T t1; +// Ill-formed (diagnostic required) +constexpr T t2(t1); // { dg-error "" } + +// Well-formed +struct U { + int i, j; + constexpr int f(int _i) { return _i; } + constexpr int g() { return i; } + constexpr U(): i(0), j(0) { } + constexpr U(const U& t) : i(f(t.i)),j(0) { } // { dg-bogus "" "" { xfail *-*-* } } + constexpr U(int _i) : i(_i),j(g()) { } // { dg-bogus "" "" { xfail *-*-* } } +}; + +constexpr U u1; +constexpr U u2(u1); // { dg-bogus "" "" { xfail *-*-* } } +constexpr U u3(1); // { dg-bogus "" "" { xfail *-*-* } } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-98.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-98.C new file mode 100644 index 000000000..4ae3944c3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-98.C @@ -0,0 +1,4 @@ +// { dg-options "-std=c++98" } + +constexpr int i = 42; // { dg-message "std=c\\+\\+0x" } +// { dg-error "constexpr" "" { target *-*-* } 3 } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-access.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-access.C new file mode 100644 index 000000000..ee5fc9854 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-access.C @@ -0,0 +1,14 @@ +// { dg-options -std=c++0x } + +class base +{ +protected: + constexpr base() { } +}; + +struct A : base { }; + +int main() +{ + A a; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr.C new file mode 100644 index 000000000..36939e1af --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr.C @@ -0,0 +1,15 @@ +// { dg-options -std=c++0x } + +template +constexpr T do_get(T* x, int n) { + return x[n - 1]; +} + +template +constexpr T get(T (&x)[N]) { + return do_get(x, N); +} + +constexpr int arr_i[] = {1}; +constexpr auto var = get(arr_i); // #2 +static_assert(var == arr_i[0], "Error"); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr2.C new file mode 100644 index 000000000..7cf733445 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr2.C @@ -0,0 +1,21 @@ +// { dg-options -std=c++0x } + +template +struct IsNegative { + int dummy; // Workaround for empty class problem + constexpr IsNegative() : dummy(0) {} + constexpr bool operator()(const T& x) { + return x < T(0); + } +}; + +template +constexpr bool has_neg(T (&x)[N], Pred p) { + return p(x[0]) || p(x[1]); +} + +constexpr int a[] = {1, -2}; + +constexpr auto answer = has_neg(a, IsNegative{}); // #1 + +static_assert(answer, "Error"); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr3.C new file mode 100644 index 000000000..f84cb5257 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr3.C @@ -0,0 +1,19 @@ +// { dg-options -std=c++0x } + +constexpr bool is_negative(int x) { + return x < 0; +}; + +constexpr bool do_has_neg(const int* x, bool(*p)(int)) { + return p(x[0]) || p(x[1]); // Line 6 +} + +constexpr bool has_neg(const int (&x)[2], bool(*p)(int)) { + return do_has_neg(x, p); // Line 10 +} + +constexpr int a[] = {1, -2}; + +constexpr auto answer = has_neg(a, is_negative); // Line 15 + +static_assert(answer, "Error"); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr4.C new file mode 100644 index 000000000..697d2d9f7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr4.C @@ -0,0 +1,23 @@ +// { dg-options -std=c++0x } + +constexpr const int do_last(const int* x, int n) { + return x[n - 1]; +} + +struct IsNegative { + constexpr bool operator()(const int& x) { + return x < 0; + } +}; + +template +constexpr bool has_neg(const int (&x)[N], Pred p) { + return p(do_last(x, N)); // Line 13 +} + +constexpr int a[] = {1, -2}; + +constexpr auto answer = has_neg(a, IsNegative{}); // Line 18 + +static_assert(answer, "Error"); + diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr5.C new file mode 100644 index 000000000..d58f254f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr5.C @@ -0,0 +1,32 @@ +// { dg-options -std=c++0x } + +template +constexpr T do_last(T* x, int n) { + return x[n - 1]; // +} + +template +constexpr T last(T (&x)[N]) { + return do_last(x, N); +} + +constexpr bool is_negative(int x) { return x < 0; } + +template +struct IsNegative { + constexpr bool operator()(const T& x) { + return x < T(0); + } +}; + +template +constexpr bool has_neg(T (&x)[N], Pred p) { + return p(last(x)); // Line 22 +} + +constexpr int a[] = {1, -2}; + +constexpr auto answer1 = has_neg(a, IsNegative{}); // Line 27 +constexpr auto answer2 = has_neg(a, is_negative); + +static_assert(answer2 == answer1, "Error"); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr6.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr6.C new file mode 100644 index 000000000..17dd6e50b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr6.C @@ -0,0 +1,18 @@ +// { dg-options "-std=c++0x" } + +typedef decltype(sizeof(char)) size_type; + +template +constexpr size_type size(T (&)[N]) { return N; } + +double array_double[] = { 1.0, 2.0, 3.0 }; + +constexpr auto sz_d = size(array_double); + +static_assert(sz_d == 3, "Array size failure"); + +void f(bool (¶m)[2]) { + static_assert(size(param) == 2, "Array size failure"); // Line 13 + short data[] = {-1, 2, -45, 6, 88, 99, -345}; + static_assert(size(data) == 7, "Array size failure"); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array-tparm.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-tparm.C new file mode 100644 index 000000000..c17090cc3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array-tparm.C @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } + +template struct A { int ir[I[0]]; }; +extern constexpr int ar[2] = { 1, 2 }; +A a; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array.C new file mode 100644 index 000000000..e37400a8b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array.C @@ -0,0 +1,15 @@ +// { dg-options -std=c++0x } +// { dg-final { scan-assembler-not "static_initialization" } } + +struct A +{ + int i; + constexpr A(): i(0) { } +}; + +struct B +{ + A a[4]; +}; + +extern const B b{}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array2.C new file mode 100644 index 000000000..9577f75d9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array2.C @@ -0,0 +1,19 @@ +// PR c++/46348 +// { dg-options -std=c++0x } + +template<__SIZE_TYPE__ _Nw> + struct _Base + { + typedef unsigned long _WordT; + + _WordT _M_w[_Nw]; + + constexpr + _Base() + : _M_w() { } + }; + +int main() +{ + _Base<256> bs; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array3.C new file mode 100644 index 000000000..145a4307e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array3.C @@ -0,0 +1,14 @@ +// PR c++/48132 +// { dg-options -std=c++0x } + +struct C +{ + constexpr C (int x) : c (x) {} + int c; +}; + +void +foo () +{ + C a[] = { C (0) }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array4.C new file mode 100644 index 000000000..9aeb75d6b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array4.C @@ -0,0 +1,14 @@ +// PR c++/49924 +// { dg-options -std=c++0x } + +struct A { constexpr A() { } }; + +struct B { + A array[1]; //non-static member array of a literal type w constexpr ctor + constexpr B() : array{} { } // here is the problem +}; + +int main() +{ + constexpr B b{}; // won't compile +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute.C new file mode 100644 index 000000000..ac85c076d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute.C @@ -0,0 +1,63 @@ +// { dg-options -std=c++0x } + +//A few constexpr's +constexpr int foo() { return __alignof__(int); } + +template +constexpr int fooT() { return __alignof__(T); } + +template +constexpr int fooN() { return N; } + +//Now the attributes + +//with normal variables, +int a __attribute__((aligned(foo()))); +int b __attribute__((aligned(fooT()))); +int c __attribute__((aligned(fooN<__alignof__(int)>()))); + +//with variables inside a template, +template +void fun() +{ + T a __attribute__((aligned(foo()))); + T b __attribute__((aligned(fooT()))); + T c __attribute__((aligned(fooN<__alignof__(T)>()))); + T d __attribute__((aligned(fooT()))); + T e __attribute__((aligned(fooN<__alignof__(int)>()))); +} + +//instantiate it, +void bar() +{ + fun(); +} + +//with classes +struct __attribute__((aligned(foo()))) S0 +{ + char dummy; +}; +S0 s0; + +struct __attribute__((aligned(fooT()))) S1 +{ + char dummy; +}; +S1 s1; + +//and class templates +template +struct __attribute__((aligned(foo()))) S2 +{ + char dummy; +}; + +S2 s2; + +template +struct __attribute__((aligned(fooT()))) S3 +{ + char dummy; +}; +S3 s3; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-auto.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-auto.C new file mode 100644 index 000000000..ddf0da0b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-auto.C @@ -0,0 +1,2 @@ +// { dg-options -std=c++0x } +constexpr auto value = 0; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-base.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-base.C new file mode 100644 index 000000000..774df318a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-base.C @@ -0,0 +1,17 @@ +// Test base/member class and static_assert with constexpr +// { dg-options -std=c++0x } + +struct A { + int i; + constexpr A(int _i): i(_i) { } +}; +struct B: A { + A a; + int j; + constexpr B(int _ib, int _ia, int _j): A(_ib), a(_ia), j(_j) { } +}; + +constexpr B b (12, 24, 36); + +#define SA(X) static_assert (X, #X) +SA(b.i==12 && b.a.i==24 && b.j==36); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-base2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-base2.C new file mode 100644 index 000000000..3ea75432a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-base2.C @@ -0,0 +1,19 @@ +// PR c++/46293 +// { dg-options -std=c++0x } + +struct A +{ +}; + +struct C +{ + int i; + constexpr C(int i): i(i) {} +}; + +struct B: A, C +{ + constexpr B(): A(), C(42) { } +}; + +constexpr B b{}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-base3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-base3.C new file mode 100644 index 000000000..cffe9ea24 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-base3.C @@ -0,0 +1,27 @@ +// PR c++/46526 +// { dg-do run } +// { dg-options "-std=c++0x" } + +struct Base +{ + virtual int getid () = 0; +}; + +struct A : public Base +{ + virtual int getid () { return 1; } +}; + +struct B : public Base +{ + virtual int getid () { throw "here"; } +}; + +int +main () +{ + A a; + B b; + Base& ar = a; + ar.getid (); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-base4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-base4.C new file mode 100644 index 000000000..ce23cb9dd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-base4.C @@ -0,0 +1,28 @@ +// PR c++/46626 +// { dg-do run } +// { dg-options "-std=c++0x" } + +struct A +{ + virtual void f () = 0; + virtual ~A () { } +}; + +struct B : A +{ + virtual void f () { } +}; + +static void +foo (A *a) +{ + a->f (); +} + +int +main () +{ + B b; + foo (&b); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield.C new file mode 100644 index 000000000..7eba49833 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield.C @@ -0,0 +1,10 @@ +// PR c++/46369 +// { dg-options -std=c++0x } + +struct A +{ + unsigned i : 1; +}; + +constexpr A f() { return { 1 }; } +constexpr bool b = (f().i == 1); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield2.C new file mode 100644 index 000000000..531bf31fc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield2.C @@ -0,0 +1,19 @@ +// PR c++/49136 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +struct day +{ + unsigned d : 5; + unsigned n : 3; + constexpr explicit day (int dd) : d(dd), n(7) {} +}; + +struct date { + int d; + constexpr date (day dd) : d(dd.n != 7 ? 7 : dd.d) {} +}; + +constexpr day d(0); +constexpr date dt(d); +static_assert (dt.d == 0, "Error"); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield3.C new file mode 100644 index 000000000..b0ecbfb9a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield3.C @@ -0,0 +1,33 @@ +// PR c++/49136 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +struct S +{ + unsigned : 1; unsigned s : 27; unsigned : 4; + constexpr S (unsigned int x) : s(x) {} +}; + +template +struct T +{ + unsigned int t; + constexpr T (S s) : t(s.s != 7 ? 0 : s.s) {} + constexpr T (S s, S s2) : t(s.s != s2.s ? 0 : s.s) {} +}; + +constexpr S s (7), s2 (7); +constexpr T t (s), t2 (s, s2); +static_assert (t.t == 7, "Error"); +static_assert (t2.t == 7, "Error"); + +struct U +{ + int a : 1; int s : 1; + constexpr U (int x, int y) : a (x), s (y) {} +}; + +constexpr U u (0, -1), u2 (-1, -1); +constexpr T t3 (u), t4 (u, u2); +static_assert (t3.t == 0, "Error"); +static_assert (t4.t == -1, "Error"); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-cleanup.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-cleanup.C new file mode 100644 index 000000000..de17f3ddb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-cleanup.C @@ -0,0 +1,9 @@ +// { dg-options -std=c++0x } + +struct A +{ + int i; + ~A(); +}; + +constexpr int i = A().i; // { dg-error "non-literal" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-complex.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-complex.C new file mode 100644 index 000000000..fbaae5dcd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-complex.C @@ -0,0 +1,17 @@ +// Make sure C99 complex works with constexpr +// { dg-options -std=c++0x } + +struct complex +{ + typedef float value_type; + typedef __complex__ float _ComplexT; + + constexpr complex(_ComplexT __z) : _M_value(__z) { } + + constexpr complex(float __r = 0.0f, float __i = 0.0f) + : _M_value(__r + __i * 1.0fi) { } + +private: + _ComplexT _M_value; +}; +constexpr complex c1; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C new file mode 100644 index 000000000..e2328fcc5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-condition.C @@ -0,0 +1,9 @@ +// { dg-options -std=c++0x } +// Core DR 948 + +constexpr int something() { return 3; } + +int main() { + if (constexpr long v = something()) {} + if (static long v = something()) { } // { dg-error "decl-specifier invalid" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C new file mode 100644 index 000000000..243409669 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C @@ -0,0 +1,18 @@ +// PR c++/48909 +// { dg-options -std=c++0x } + +#define SA(X) static_assert((X),#X) + +constexpr int const * is_sorted_until(int const * first, int const * last) +{ + return first == last || first + 1 == last ? last + : (*(first + 1) < *first) != false ? first + 1 + : is_sorted_until(first + 1, last); +} + +int main() +{ + static constexpr int array[2] = {0, 1}; + constexpr int const * last = is_sorted_until(array, array + 2); + SA(last==array+2); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor.C new file mode 100644 index 000000000..91c489db2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++0x } + +struct A +{ + int i; + constexpr A() { } // { dg-error "uninitialized member .A::i" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor2.C new file mode 100644 index 000000000..5280b131b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor2.C @@ -0,0 +1,11 @@ +// { dg-options -std=c++0x } + +struct A +{ + A(); +}; + +struct B : A +{ + constexpr B(): A() { } // { dg-error "A::A" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor3.C new file mode 100644 index 000000000..d5bfbad3d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor3.C @@ -0,0 +1,10 @@ +// PR c++/46348 +// { dg-options -std=c++0x } + +struct A +{ + int arr[1]; + + constexpr A() + : arr() { } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor4.C new file mode 100644 index 000000000..397b4b054 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor4.C @@ -0,0 +1,15 @@ +// PR c++/46873 +// { dg-options -std=c++0x } + +struct S +{ + int i:1; +}; + +struct T +{ + const S s; + constexpr T (S a = S ()) : s (a) { } +}; + +T t; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor5.C new file mode 100644 index 000000000..36b01785f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor5.C @@ -0,0 +1,30 @@ +// PR c++/46877 +// { dg-options -std=c++0x } + +struct new_allocator +{ + constexpr new_allocator (); +}; + +struct string +{ + constexpr string () + { + } + new_allocator a; +}; + +struct pair +{ + const string first; + constexpr pair () + { + } +}; + +constexpr +new_allocator::new_allocator () +{ +} + +pair p; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor6.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor6.C new file mode 100644 index 000000000..4f86f73a4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor6.C @@ -0,0 +1,9 @@ +// PR c++/47041 +// { dg-options "-std=c++0x -fno-elide-constructors" } + +struct S +{ + int i; +}; + +S s = S (); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor7.C new file mode 100644 index 000000000..8338bf1f7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor7.C @@ -0,0 +1,17 @@ +// PR c++/47199 +// { dg-options "-std=c++0x -fno-elide-constructors" } + +template < int > struct S +{ + constexpr S (int r):rr (r) + { + } + S (const S &) = default; + static constexpr S s () + { + return -1; + } + int rr; +}; + +static const int d = S < 0 >::s ().rr; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor8.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor8.C new file mode 100644 index 000000000..81fc83737 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor8.C @@ -0,0 +1,6 @@ +// PR c++/46466 +// { dg-options "-std=c++0x -fno-elide-constructors" } + +struct S { bool b; }; +constexpr S f() { return S{true}; } +static_assert(f().b, ""); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor9.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor9.C new file mode 100644 index 000000000..b7693f1e6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor9.C @@ -0,0 +1,19 @@ +// PR c++/47774 +// { dg-options -std=c++0x } + +struct A +{ + A() {} +}; + +template +struct array +{ + constexpr array() : mem() {} + T mem[7]; +}; + +int main() +{ + array ar; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-data1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-data1.C new file mode 100644 index 000000000..0943fa422 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-data1.C @@ -0,0 +1,43 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// From N2235 + +// 1 +struct A2 +{ + static const int eights = 888; + static constexpr int nines = 999; +}; + +A2 a; + +// 2 +struct pixel +{ + int x, y; +}; +constexpr pixel ur = { 1294, 1024 }; // OK + +// p4 +struct Length +{ + explicit constexpr Length(int i = 0) : val(i) { } +private: + int val; +}; + +constexpr int myabs(int x) +{ return x < 0 ? -x : x; } // OK + +Length l(myabs(-97)); // OK + +// p6 +class debug_flag +{ +public: + explicit debug_flag(bool); + constexpr bool is_on(); // { dg-error "enclosing class .* not a literal type" } +private: + bool flag; +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C new file mode 100644 index 000000000..2d614ec32 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C @@ -0,0 +1,47 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +template + struct A3 + { + typedef _Tp value_type; + typedef A3 type; + + static constexpr value_type value = v; + + constexpr operator value_type() { return value; } + }; + +// Partial specialization. +template + struct A3<_Tp*, v> + { + typedef _Tp* value_type; + typedef A3 type; + + static constexpr value_type value = v; + + constexpr operator value_type() { return value; } + }; + +// Explicit specialization. +template<> + struct A3 + { + typedef unsigned short value_type; + typedef A3 type; + + static constexpr value_type value = 0; + + constexpr operator value_type() { return value; } + }; + +// Explicitly instantiate. +template struct A3; + +// Extern explicitly instantiate. +extern template struct A3; + +// Use. +A3 a31; +A3 a32; // { dg-warning "overflow" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-decl.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-decl.C new file mode 100644 index 000000000..0a3fcb656 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-decl.C @@ -0,0 +1,10 @@ +// PR c++/46930 +// { dg-options -std=c++0x } + +struct S { + static constexpr int size; // { dg-error "must have an initializer" } + // { dg-error "previous declaration" "" { target *-*-* } 5 } +}; + +const int limit = 2 * S::size; +constexpr int S::size = 256; // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg.C new file mode 100644 index 000000000..1413b24bd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg.C @@ -0,0 +1,12 @@ +// PR c++/46335 +// { dg-options -std=c++0x } + +struct T { }; +struct A { + A(const T &tr =T()) {} +}; +struct B { + A k; +}; +B kk_; +A fk_; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C new file mode 100644 index 000000000..faa8a3603 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C @@ -0,0 +1,44 @@ +// PR c++/46368 +// { dg-options "-std=c++0x" } + +class A; + +class B +{ + A foo (); + A bar (); +}; + +class C +{ +}; + +struct D +{ + D (C); +}; + +struct A : D +{ + A (const C & n) : D (n) {} +}; + +A baz (const char *, A = C ()); + +A +B::foo () +{ + try + { + baz ("foo"); + } + catch (...) + { + } +} + +A +B::bar () +{ + baz ("bar"); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-delete.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-delete.C new file mode 100644 index 000000000..67c950302 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-delete.C @@ -0,0 +1,3 @@ +// { dg-options -std=c++0x } + +constexpr bool never() = delete; // useless, but OK diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-deref.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-deref.C new file mode 100644 index 000000000..7363e98ec --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-deref.C @@ -0,0 +1,16 @@ +// { dg-options -std=c++0x } + +struct A +{ + const int *p[2]; +}; + +constexpr const int * f(const int *p) { return p; } + +int main() +{ + constexpr int i = 42; + constexpr int j = *&i; // OK + constexpr int k = *A{{&i}}.p[0]; // OK + constexpr int l = *f(&i); // OK +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C new file mode 100644 index 000000000..183d3f768 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C @@ -0,0 +1,20 @@ +// Test that we explain why a template instantiation isn't constexpr +// { dg-options -std=c++0x } + +template +struct A +{ + T t; + constexpr int f() { return 42; } // { dg-error "enclosing class" } +}; + +struct B { B(); operator int(); }; + +constexpr A ai = { 42 }; +constexpr int i = ai.f(); + +constexpr int b = A().f(); // { dg-error "not a constexpr function" } + +template +constexpr int f (T t) { return 42; } // { dg-error "parameter" } +constexpr int x = f(B()); // { dg-error "constexpr function" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag2.C new file mode 100644 index 000000000..c78416ec1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag2.C @@ -0,0 +1,5 @@ +// PR c++/47207 +// { dg-options -std=c++0x } + +constexpr int X (X); // { dg-error "not usable" } +// { dg-message "own initializer" "" { target *-*-* } 4 } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-eh-spec.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-eh-spec.C new file mode 100644 index 000000000..6d231fafa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-eh-spec.C @@ -0,0 +1,9 @@ +// { dg-options -std=c++0x } +template class my_limits { +public: + static constexpr T min() throw() { return T(); } + static constexpr T max() noexcept { return T(); } +}; + +constexpr double var_min = my_limits::min(); // #1 OK +constexpr double var_max = my_limits::max(); // #2 Error diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ellipsis.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ellipsis.C new file mode 100644 index 000000000..5d090b541 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ellipsis.C @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } +constexpr int ellipsis(...) { return 1; } + +constexpr int ellipsis_c = ellipsis(); // OK +constexpr int ellipsis_c2 = ellipsis(42); // Internal error diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ellipsis2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ellipsis2.C new file mode 100644 index 000000000..0bb690406 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ellipsis2.C @@ -0,0 +1,12 @@ +// { dg-options -std=c++0x } + +struct A +{ + A(); + A(const A&); + bool empty(); +}; + +constexpr int ellipsis(...) { return 1; } + +static_assert(ellipsis(A().empty()), "Error"); // { dg-error "non-constant condition|empty" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty.C new file mode 100644 index 000000000..a9fc4388a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++0x } + +struct Empty {}; + +constexpr bool f(Empty) { return true; } + +constexpr bool x(f(Empty{})); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty2.C new file mode 100644 index 000000000..ef2121194 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty2.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++0x } + +struct IsLiteral {}; + +constexpr IsLiteral bar(IsLiteral x) { return x; } + +constexpr auto xy = bar(IsLiteral()); // #1 Error, but should be OK diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty3.C new file mode 100644 index 000000000..e0026fcc7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty3.C @@ -0,0 +1,9 @@ +// { dg-options -std=c++0x } + +struct IsLiteral {}; + +constexpr auto ab = IsLiteral(); + +constexpr IsLiteral bar(IsLiteral x) { return x; } + +constexpr auto xy = bar(ab); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty4.C new file mode 100644 index 000000000..b07f92464 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty4.C @@ -0,0 +1,34 @@ +// { dg-options -std=c++0x } + +typedef decltype(sizeof(char)) size_type; + +template +constexpr size_type do_find_if_or_stop(T (&x)[N], size_type i, Pred p); + +template +constexpr size_type do_find_if(T (&x)[N], size_type i, Pred p) { + return p(x[i]) ? i : do_find_if_or_stop(x, i + 1, p); // line 8 +} + +template +constexpr size_type do_find_if_or_stop(T (&x)[N], size_type i, Pred p) { + return i == N ? N : do_find_if(x, i, p); +} // Line 14 + +template +constexpr size_type find_if(T (&x)[N], Pred p) { + return do_find_if(x, 0, p); // Line 18 +} + +constexpr long items_long[] = {1, 2, 3, 4, -5, 6, -7, 8}; + +template +struct IsNegative { + constexpr bool operator()(const T& x) { + return x < T(0); + } +}; + +constexpr auto pos1 = find_if(items_long, IsNegative{}); // Line 30 + +static_assert(pos1 == 4, "find_if failure"); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty5.C new file mode 100644 index 000000000..9bd9aa583 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty5.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++0x } + +struct A { }; +struct B: A { }; + +constexpr B b { }; +constexpr A a = b; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C new file mode 100644 index 000000000..4ab467780 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C @@ -0,0 +1,94 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// From N2235 + +// 4.1 constant-expression functions +// 1 examples + + + + + +// 2 defined before first use +// NOTE: this is only needed in contexts that require a constant-expression +struct S { + constexpr int twice(); + constexpr int t(); // { dg-message "used but never defined" } +private: + static constexpr int val = 7; // constexpr variable +}; + +constexpr int S::twice() { return val + val; } +constexpr S s = { }; +int x1 = s.twice(); // ok +int x2 = s.t(); // error: S::t() not defined +constexpr int x2a = s.t(); // { dg-error "S::t" } error: S::t() not defined +constexpr int ff(); // ok +constexpr int gg(); // ok +int x3 = ff(); // error: ff() not defined +constexpr int x3a = ff(); // { dg-error "ff" } error: ff() not defined +constexpr int ff() { return 1; } // too late +constexpr int gg() { return 2; } +int x4 = gg(); // ok + + +// 4.2 const-expression data + +// 2 +// storage not allocated untill address taken +constexpr double x = 9484.748; +const double* p = &x; // the &x forces x into memory + +// 4.3 constant-expression constructors + +// 1 +struct complex { + constexpr complex(double r, double i) : re(r), im(i) { } + constexpr double real() { return re; } + constexpr double imag() { return im; } +private: + double re; + double im; +}; +constexpr complex I(0, 1); // OK -- literal complex + + +// 2 invoked with non-const args +double x5 = 1.0; // { dg-message "not declared .constexpr" } +constexpr complex unit(x5, 0); // { dg-error "x5|argument" } error: x5 non-constant +const complex one(x5, 0); // OK, ‘‘ordinary const’’ -- dynamic + // initialization +constexpr double xx = I.real(); // OK +complex z(2, 4); // OK -- ordinary variable + +// 3 +constexpr complex v[] = { + complex(0, 0), complex(1, 1), complex(2, 2) +}; +constexpr double x6 = v[2].real(); // OK + +// 4 + constexpr int i = 98; + typedef __INTPTR_TYPE__ intptr_t; + constexpr intptr_t ip = (intptr_t) &i; // { dg-error "constant" } + +// 4.3.2 copy-constructor +constexpr complex operator+(complex z, complex w) +{ + return complex(z.real() + w.real(), z.imag() + w.imag()); // fine +} +constexpr complex I2 = I + I; // OK +struct resource { + int id; + constexpr resource(int i) : id(i) { } // fine + resource(const resource& r) : id(r.id) // oops, not constexpr + { + //cout << id << " copied" << endl; + } +}; +constexpr resource f(resource d) +{ return d; } // { dg-error "not .constexpr" } +constexpr resource d = f(9); // { dg-error "resource" } + +// 4.4 floating-point constant expressions diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex2.C new file mode 100644 index 000000000..29e835c4b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex2.C @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// From N2235 + +// 4.5.3 constant expressions + +// p 4 +struct A { + constexpr A(int i) : val(i) { } + constexpr operator int() { return val; } + constexpr operator long() { return -1; } +private: + int val; +}; + +template struct X { static const int i = I; }; +constexpr A a = 42; + +X x; // OK: unique conversion to int +int ar[X::i]; // also OK +int ary[a]; // { dg-error "ambiguous|conversion|array" } ambiguous conversion + diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C new file mode 100644 index 000000000..08552cd7d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C @@ -0,0 +1,30 @@ +// { dg-options "-std=c++0x" } + +#define SA(X) static_assert (X, #X) + +struct A +{ + int i; + constexpr A(int _i) { i = _i; } // { dg-error "empty body|uninitialized member" } +}; + +template +struct B +{ + T t; + constexpr B(T _t): t(_t) { } +}; + +B b(1); // { dg-message "not declared .constexpr" } +SA(b.t==1); // { dg-error "non-constant condition|'b'" } +constexpr B b2(1); +SA(b2.t==1); + +template +constexpr T f(T a, T b) +{ + typedef T myT; + return a + b; +} + +SA(f(1,2)==3); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex4.C new file mode 100644 index 000000000..4214f5c52 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex4.C @@ -0,0 +1,16 @@ +// { dg-options "-std=c++0x" } + +struct A +{ + constexpr A(int) { } + constexpr operator int() { return 1; }; +}; + +template +struct B +{ + static constexpr A a = A(1); + int ar[a]; +}; + +B b; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-expinst.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-expinst.C new file mode 100644 index 000000000..208987369 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-expinst.C @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } +// Error: Explicit instantiation of a function template shall not use the +// inline or constexpr specifiers +template constexpr inline T bar(T x) { return x; } +template constexpr inline float bar(float x); // { dg-error "specifier" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-explicit-inst.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-explicit-inst.C new file mode 100644 index 000000000..8f0da0af0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-explicit-inst.C @@ -0,0 +1,9 @@ +// { dg-options -std=c++0x } + +template constexpr inline T bar(T x) { return x; } + +template short bar(short x); // #EI + +constexpr auto yz = bar(0); // OK +constexpr auto ab = bar(short()); // #1 Error, but should be OK +constexpr auto mn = bar(short{}); // #2 Error, but should be OK diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-fnptr.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-fnptr.C new file mode 100644 index 000000000..4c84d827f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-fnptr.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++0x } + +constexpr bool is_negative(int x) { return x < 0; } + +constexpr bool check(int x, bool (*p)(int)) { return p(x); } // #1 + +static_assert(check(-2, is_negative), "Error"); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-friend.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-friend.C new file mode 100644 index 000000000..f1d9ccee7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-friend.C @@ -0,0 +1,23 @@ +// PR c++/48948 +// { dg-options -std=c++0x } + +struct A { A(); }; + +struct B { + friend constexpr int f(B) { return 0; } // OK + friend constexpr int f(A) { return 0; } // { dg-error "constexpr" } +}; + +template +struct C +{ + friend constexpr int f(C) { return 0; } + friend constexpr int g(C, A) { return 0; } // { dg-error "double" } + constexpr int m(C) { return 0; } + constexpr int m(A) { return 0; } // { dg-error "double" } +}; + +constexpr int i = f(C()); +constexpr int j = C().m(C()); +constexpr int k = C().m(A()); // { dg-error "not a constexpr function" } +constexpr int l = g(C(),A()); // { dg-error "not a constexpr function" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-function1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-function1.C new file mode 100644 index 000000000..c708b040f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-function1.C @@ -0,0 +1,10 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// From N2235 + +constexpr int veryabs(int x) { return x < 0 ? -x : x; } + +constexpr long long_max() { return 2147483647; } + +constexpr int verysquare(int x) { return x * x; } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C new file mode 100644 index 000000000..5a2ec76e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C @@ -0,0 +1,50 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// From N2235 + +// Mess with the builtin by redeclaring. +constexpr int abs(int x) { return x < 0 ? -x : x; } + +extern "C" +{ + constexpr float + squaref(float x) { return x * x; } +} + +// implicitly inline, already: warn? +inline constexpr double +squared(double x) { return x * x; } + +constexpr int squarei(int x) { return x * x; } +extern const int side; // { dg-message "not initialized with a constant expression" } +constexpr int area = squarei(side); // { dg-error "side|argument" } +// error: squarei(side) is not a constant expression + +int next(constexpr int x) // { dg-error "parameter" } +{ return x + 1; } + +constexpr void f(int x) // { dg-error "return type .void" } +{ /* ... */ } + +constexpr int prev(int x) +{ return --x; } // { dg-error "--" } + +constexpr int g(int x, int n) // error: body not just ‘‘return expr’’ +{ + int r = 1; + while (--n > 0) r *= x; + return r; +} // { dg-error "not a return-statement" } + +constexpr int +bar(int x, int y) { return x + y + x * y; } // { dg-error "previously" } + +int bar(int x, int y) // { dg-error "redefinition" } +{ return x * 2 + 3 * y; } + +constexpr int twice(int x); // { dg-message "never defined" } +enum { bufsz = twice(256) }; // { dg-error "" } twice() isn’t (yet) defined + +constexpr int fac(int x) +{ return x > 2 ? x * fac(x - 1) : 1; } // OK diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-function3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-function3.C new file mode 100644 index 000000000..e8ca7bc68 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-function3.C @@ -0,0 +1,30 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// From N2235 + +// function template 1 +template + constexpr int bytesize(T t) + { return sizeof (t); } // OK + +char buf[bytesize(0)]; // OK -- not C99 VLA + + +// function template 2 +template + constexpr _Tp + square(_Tp x) { return x; } + +// Explicit specialization +template<> + constexpr unsigned long + square(unsigned long x) { return x * x; } + +// Explicit instantiation +template int square(int); + +class A { }; +template A square(A); + +template long square(long); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C new file mode 100644 index 000000000..3b72484a0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice.C @@ -0,0 +1,11 @@ +// We used to crash on this instead of giving a decent error. +// { dg-options -std=c++0x } + +struct A { int i; }; + +struct B { + const A *a; + constexpr B(const A& a): a(&a) { } +}; + +constexpr B b{A{42}}; // { dg-error "constant|expansion" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice2.C new file mode 100644 index 000000000..35643b990 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice2.C @@ -0,0 +1,3 @@ +// { dg-options -std=c++0x } +int x; +constexpr int& rx = x; // { dg-error "int&" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice3.C new file mode 100644 index 000000000..23903bca7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice3.C @@ -0,0 +1,13 @@ +// PR c++/46289 +// { dg-options -std=c++0x } + +struct A +{ + int i; +}; + +struct B +{ + A a; + constexpr B(): a({1,2}) { } // { dg-error "" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete1.C new file mode 100644 index 000000000..71372d226 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete1.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++0x } + +struct A +{ + static constexpr A a = 1; // { dg-error "incomplete|literal" } + constexpr A(int i) { } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C new file mode 100644 index 000000000..dc0b7429d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C @@ -0,0 +1,31 @@ +// A constructor that might or might not be constexpr still makes +// its class literal. +// { dg-options -std=c++0x } + +template +struct B +{ + constexpr B(T) { } + constexpr B() {} +}; + +struct A +{ + B b; +}; + +constexpr A a {}; + +template +struct C +{ + constexpr C(T) { } + C() {} +}; + +struct D +{ + C c; +}; + +constexpr D d {}; // { dg-error "not a constexpr function" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete3.C new file mode 100644 index 000000000..81822b07e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete3.C @@ -0,0 +1,12 @@ +// PR c++/49015 +// { dg-options -std=c++0x } + +class A; + +class B { + friend constexpr B f(A); // Line 5 +}; + +class A {}; + +constexpr B f(A) { return B(); } // Line 10 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist.C new file mode 100644 index 000000000..6854e7341 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist.C @@ -0,0 +1,65 @@ +// { dg-options -std=c++0x } +// { dg-do run } + +namespace xstd { + +typedef decltype(sizeof(char)) size_t; + +template +class initializer_list { +private: + size_t sz; + const E* start; + +public: + typedef E value_type; + typedef const E& reference; + typedef const E& const_reference; + typedef size_t size_type; + typedef const E* iterator; + typedef const E* const_iterator; + + constexpr initializer_list() : sz(), start(nullptr) {} + + template + constexpr initializer_list(const E(&array)[N]) : sz(N), start(array) {} + + constexpr size_t size() { return sz; } + + constexpr const E* begin() { return start; } + + constexpr const E* end() { return start + sz; } +}; + +template +constexpr initializer_list make_list(const E(&array)[N]) { + return initializer_list(array); +} + +template +E min(initializer_list list) +{ + // static_assert(list.size() > 0, "Invalid list"); + auto it = list.begin(); + E result = *it; + for (++it; it != list.end(); ++it) { + if (*it < result) { + result = *it; + } + } + return result; +} + +} + +constexpr int global_i[] = {2, 4, -5, 6, 10}; +constexpr xstd::initializer_list list(global_i); +#define SA(X) static_assert(X, #X) +SA(list.size() == 5); +SA(list.begin()[2] == -5); +SA(list.end()[-1] == 10); + +int main() { + if (xstd::min(xstd::make_list(global_i)) != -5) + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist2.C new file mode 100644 index 000000000..f34b98016 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist2.C @@ -0,0 +1,10 @@ +// { dg-options -std=c++0x } + +#include + +constexpr auto list = { 1, 2, 3, 4 }; + +#define SA(X) static_assert(X, #X) +SA(list.size() == 4); +SA(list.begin()[2] == 3); +SA(list.end()[-1] == 4); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist3.C new file mode 100644 index 000000000..7620e6b2c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist3.C @@ -0,0 +1,12 @@ +// { dg-options -std=c++0x } + +#include +#define SA(X) static_assert(X,#X) + +constexpr int f(std::initializer_list l) { return l.begin()[0]; } + +int main() +{ + constexpr int i = f({42}); + SA(i==42); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist5.C new file mode 100644 index 000000000..97f039998 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist5.C @@ -0,0 +1,15 @@ +// PR c++/50024 +// { dg-options -std=c++0x } + +template< class T > +struct Container +{ + Container(){ + int* ptr = new int{}; + } +}; + +int main() { + Container< int > c; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-is_literal.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-is_literal.C new file mode 100644 index 000000000..d1b95437d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-is_literal.C @@ -0,0 +1,38 @@ +// { dg-options -std=c++0x } + +#include + +#define IS_LIT(T) (std::is_literal_type::value) +#define SA(X) static_assert (X, #X) +#define YES(T) SA(IS_LIT(T)) +#define NO(T) SA(!IS_LIT(T)) + +enum E1 { }; +enum class E2 { }; +struct Literal {}; + +struct NotLiteral { + ~NotLiteral(); +}; + +YES(int); +YES(int[]); +YES(int[3]); +YES(double); +YES(void *); +YES(decltype (nullptr)); +YES(int Literal::*); +YES(void (Literal::*)()); +YES(E1); +YES(E2); +YES(Literal); +NO (NotLiteral); +YES(NotLiteral *); +YES(NotLiteral NotLiteral::*); +YES(NotLiteral (NotLiteral::*)(NotLiteral)); + +struct A { + A(const A&) = default; +}; + +NO(A); // no constexpr ctor other than copy diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C new file mode 100644 index 000000000..ef7ac6b48 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C @@ -0,0 +1,18 @@ +// PR c++/48296 +// { dg-options -std=c++0x } + +struct X +{ + constexpr X() { } + constexpr X f(X x) { return x; } + constexpr X g(X x); +}; + +constexpr X X::g(X x) { return x; } + +struct Y +{ + Y() { } + constexpr Y f(Y y); // { dg-error "not a literal type" } + static constexpr Y g(Y y) {} // { dg-error "constexpr" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-missing.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-missing.C new file mode 100644 index 000000000..547f552e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-missing.C @@ -0,0 +1,39 @@ +// PR c++/48911 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +#define SA(X) static_assert((X),#X) + +struct A +{ + constexpr A () : a (6) {} + int a; +}; + +int +main () +{ + constexpr int a[2] = { 42 }; + constexpr int i = a[1]; + SA(i==0); + constexpr int b[1] = { }; + constexpr int j = b[0]; + SA(j==0); + constexpr char c[2] = "a"; + constexpr char k = c[1]; + SA(k==0); + constexpr char d[2] = ""; + constexpr char l = d[1]; + SA(l==0); + constexpr wchar_t e[2] = L"a"; + constexpr wchar_t m = e[1]; + SA(m==0); + constexpr wchar_t f[2] = L""; + constexpr wchar_t n = f[1]; + SA(n==0); + constexpr A g[2] = { A () }; + constexpr A o = g[0]; + SA(o.a == 6); + constexpr A p = g[1]; + SA(p.a == 6); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C new file mode 100644 index 000000000..8294afa98 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C @@ -0,0 +1,69 @@ +// Negative examples from N3092 (FCD) +// { dg-options -std=c++0x } + +// OK: declaration +constexpr int square(int x); // { dg-message "never defined" } + +// error: pixel is a type +constexpr struct pixel { + int x; + int y; + // OK: declaration + constexpr pixel(int); +}; // { dg-error "constexpr" } +constexpr pixel::pixel(int a) +// OK: definition + : x(square(a)), y(square(a)) // { dg-error "square" } +{ } + +// error: square not defined, so small(2) not constant (5.19), so constexpr +// not satisfied +constexpr pixel small(2); // { dg-message "in constexpr expansion" } + +// error: not for parameters +int next(constexpr int x) { // { dg-error "parameter" } + return x + 1; +} + +// error: not a definition +extern constexpr int memsz; // { dg-error "definition" } + +// error: return type is void +constexpr void f(int x) // { dg-error "void" } +{ /* ... */ } +// error: use of decrement +constexpr int prev(int x) +{ return --x; } // { dg-error "-- x" } + +// error: body not just return expr +constexpr int g(int x, int n) { + int r = 1; + while (--n > 0) r *= x; + return r; +} // { dg-error "body of constexpr function" } + +class debug_flag { +public: + explicit debug_flag(bool); + constexpr bool is_on(); // { dg-error "not a literal type" } debug_flag not literal type +private: + bool flag; +}; +// OK +constexpr int bar(int x, int y) // { dg-error "previously defined here" } +{ return x + y + x*y; } +// ... +// error: redefinition of bar +int bar(int x, int y) // { dg-error "redefinition" } +{ return x * 2 + 3 * y; } + +struct pixel2 { // { dg-message "no user-provided default constructor" } + int x, y; +}; +constexpr pixel2 ur = { 1294, 1024 };// OK +constexpr pixel2 origin; // { dg-error "uninitialized const" } + +constexpr const int* addr(const int& ir) { return &ir; } // OK + +// error, initializer for constexpr variable not a constant +extern constexpr const int* tp = addr(5); // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept.C new file mode 100644 index 000000000..0476f9096 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept.C @@ -0,0 +1,13 @@ +// { dg-options -std=c++0x } + +template +struct is_funny { + static constexpr bool value = false; +}; + +template +constexpr T value(T t) noexcept(is_funny::value) { return t; } // Line 7 + +constexpr bool ok = noexcept(value(42)); + +static_assert(ok, "Assertion failure"); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept2.C new file mode 100644 index 000000000..95a1443fa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept2.C @@ -0,0 +1,14 @@ +// { dg-options -std=c++0x } + +template +constexpr T value(T t) { return t; } + +template +struct is_funny { + static constexpr bool value = false; +}; + +template +void eval() noexcept(value(is_funny::value)) {} + +constexpr bool ok = noexcept(eval()); // line 12 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept3.C new file mode 100644 index 000000000..6e76ea8fa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept3.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++0x } + +constexpr int f(int i) { return i; } +#define SA(X) static_assert (X, #X) +SA(noexcept(f(42))); +int j; +SA(!noexcept(f(j))); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept4.C new file mode 100644 index 000000000..119d4e167 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept4.C @@ -0,0 +1,14 @@ +// { dg-options -std=c++0x } +// A call is noexcept if it is a valid subexpression of a constant +// expression, even if it is not itself a constant expression. + +#define SA(X) static_assert(X,#X) + +constexpr const int* f(const int *p) { return p; } + +int main() +{ + constexpr int i = 42; + SA(noexcept(*f(&i))); + SA(noexcept(f(&i))); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C new file mode 100644 index 000000000..7bf961b3c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C @@ -0,0 +1,15 @@ +// { dg-options -std=c++0x } + +struct booleable { + bool data; + constexpr explicit operator bool() { return data; } +}; + +constexpr booleable truthy_func() { return {true}; } + +void funky() noexcept(truthy_func()) {} + +int main() { + funky(); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C new file mode 100644 index 000000000..7637c0a05 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C @@ -0,0 +1,24 @@ +// Example from issue 1125 drafting; D() and v were well-formed with the +// wording approved in Rapperswil, now seems they should be ill-formed. +// { dg-options "-std=c++0x -pedantic-errors" } + +struct B { + constexpr B(int x) : i(0) { } // "x" is unused + int i; +}; + +int global; // { dg-message "not const" } + +struct D : B { + constexpr D() : B(global) { } // { dg-error "global|argument" } +}; + +struct A2 { + constexpr A2(bool b, int x) : m(b ? 42 : x) { } + int m; +}; + +// ok, constructor call initializes m with the value 42 after substitution +constexpr int v = A2(true, global).m; // { dg-error "global" } +// error: initializer for m is "x", which is non-constant +constexpr int w = A2(false, global).m; // { dg-error "global" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg2.C new file mode 100644 index 000000000..20e05c3c0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg2.C @@ -0,0 +1,16 @@ +// PR c++/47200 +// { dg-options "-std=c++0x -w" } + +template < int > struct duration +{ + constexpr int count (); + static constexpr duration min (); +}; + +constexpr int +f (duration < 0 > d, duration < 0 > ) +{ + return d.count (); +} + +static_assert (f (duration < 0 >::min (), duration < 0 > ()), ""); // { dg-error "non-constant|before its definition" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg3.C new file mode 100644 index 000000000..581be6d15 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg3.C @@ -0,0 +1,23 @@ +// PR c++/49988 +// { dg-options -std=c++0x } +// { dg-do run } + +template struct X { }; + +struct A { + char data[3]; + template + constexpr + A(const char (&s)[3], X x) : data{ s[I]...} { } +}; +struct B { + A a; + B(const char (&s)[3]) : a{s,X<0,1,2>{}} { } +}; + +int main() +{ + B b{"12"}; + if (b.a.data[0] != '1') + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-nonlit.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-nonlit.C new file mode 100644 index 000000000..9104c8afa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-nonlit.C @@ -0,0 +1,13 @@ +// FIXME this is currently invalid, but seems like it should be OK +// { dg-options -std=c++0x } + +struct A { A() { } }; + +template +constexpr bool ignore(T&&) { return true; } + +static_assert(ignore(10), "Error"); // OK + +A s; + +static_assert(ignore(s), "Error"); // Currently an error diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-nonlit2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-nonlit2.C new file mode 100644 index 000000000..21e8bd509 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-nonlit2.C @@ -0,0 +1,19 @@ +// { dg-options -std=c++0x } + +struct A +{ + ~A(); +}; + +template +struct W { + T t; + template + constexpr W(U&& u) : t(u) {} +}; + +template +constexpr W make_w(T& w) { return W(w); } + +A a; +constexpr auto w = make_w(a); // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-nonstatic.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-nonstatic.C new file mode 100644 index 000000000..3951fbdb1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-nonstatic.C @@ -0,0 +1,6 @@ +// { dg-options -std=c++0x } + +struct A +{ + constexpr int i; // { dg-error "" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr.C new file mode 100644 index 000000000..7ac53db48 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr.C @@ -0,0 +1,6 @@ +// { dg-options -std=c++0x } + +constexpr int zero() { return 0; } + +void* ptr1 = zero(); // #1 +constexpr void* ptr2 = zero(); // #2 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-object1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-object1.C new file mode 100644 index 000000000..4ff398bf1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-object1.C @@ -0,0 +1,31 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// From N2235 + +// 4.5.2 semantics + +// p 1 constexpr specifier +// objects, static const data +struct A1 { int i; }; // { dg-message "no user-provided default constructor" } + +constexpr int i1 = 1024; +constexpr A1 a1 = A1(); + +// error: not a definition +extern constexpr int i2; // { dg-error "definition" } + +// error: missing initializer +constexpr A1 a2; // { dg-error "uninitialized const" } + +// error: duplicate cv +const constexpr A1 a3 = A1(); // { dg-error "both .const. and .constexpr. cannot" } + +volatile constexpr A1 a4 = A1(); // { dg-error "both .volatile. and .constexpr. cannot" } + +// error: on type declaration +constexpr struct pixel +{ + int x; + int y; +}; // { dg-error "cannot be used for type declarations" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-object2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-object2.C new file mode 100644 index 000000000..a038970f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-object2.C @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +constexpr int verysquare(int x) { return x * x; } + +const double mass = 9.8; +constexpr double energy = mass * verysquare(56.6); // { dg-error "mass" "" { xfail *-*-* } } + +int arr[(int)mass]; // { dg-error "mass" "" { xfail *-*-* } } + +float array[verysquare(9)]; // OK -- not C99 VLA + +extern const int medium; +const int high = verysquare(medium); // OK -- dynamic initialization + +enum { Max = verysquare(7) }; // OK diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow.C new file mode 100644 index 000000000..9b3b1fa0e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow.C @@ -0,0 +1,6 @@ +// { dg-options "-std=c++0x -w" } + +#include +extern constexpr int max_s = INT_MAX + 1; // { dg-error "" } +extern constexpr unsigned max_u = UINT_MAX + 1u; // OK +extern constexpr int abs_s = -INT_MIN; // { dg-error "" } overflows on 2's complement machines diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C new file mode 100644 index 000000000..5d5749ce2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C @@ -0,0 +1,8 @@ +// PR c++/47504 +// { dg-options -std=c++0x } + +char constexpr sub(char arg) +{ return char(arg - char(1)); } + +int main() +{ static char constexpr m = sub(-1); } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C new file mode 100644 index 000000000..dc393d759 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C @@ -0,0 +1,16 @@ +// The FCD doesn't allow typedefs and static_assert in constexpr functions, +// but it should. +// { dg-options "-std=c++0x -pedantic" } + +template +constexpr T f(T t) +{ + typedef T T2; // { dg-warning "constexpr" "" { xfail *-*-* } } + static_assert (T2(0) == T(0), ""); // { dg-warning "constexpr" "" { xfail *-*-* } } + return t; +} + +int main() +{ + constexpr int i = f(42); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-pos1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-pos1.C new file mode 100644 index 000000000..775080acc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-pos1.C @@ -0,0 +1,60 @@ +// Positive examples from N3092 (FCD) +// { dg-options -std=c++0x } + +#define SA(X) static_assert(X, #X) + +constexpr int bufsz = 1024; // OK: definition +SA (bufsz == 1024); + +constexpr int square(int x); // OK: declaration + +struct pixel { + int x; + int y; + // OK: declaration + constexpr pixel(int); +}; +constexpr pixel::pixel(int a) // OK: definition + : x(square(a)), y(square(a)) +{ } + +constexpr int square(int x) // OK: definition +{ return x * x; } + +constexpr pixel large(4); // OK: square defined +SA(large.x == 16 && large.y==16); + +constexpr long long_max() // OK +{ return 2147483647; } + +SA(long_max() == 2147483647); + +constexpr int abs(int x) // OK +{ return x < 0 ? -x : x; } + +SA(abs(-1) == 1); +SA(abs(24) == 24); + +struct Length { + explicit constexpr Length(int i = 0) : val(i) { } +private: + int val; +}; + +constexpr Length l1; +constexpr Length l2(12); + +struct pixel2 { + int x, y; +}; +constexpr pixel2 ur = { 1294, 1024 };// OK + +SA(ur.x == 1294 && ur.y == 1024); + +constexpr const int* addr(const int& ir) { return &ir; } // OK +static const int x = 5; +extern constexpr const int* xp = addr(x); // OK: (const int*)&(const int&)x + // is an address contant expression +SA(xp == &x); +extern constexpr int x2 = *addr(5); +SA(x2 == 5); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-potential1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-potential1.C new file mode 100644 index 000000000..e933506b8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-potential1.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++0x } +// We decided in Rapperswil that it's OK if any value of decide can produce +// a constant expression. + +constexpr int may_throw(bool decide) { + return decide ? 42 : throw -1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ptrmem.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ptrmem.C new file mode 100644 index 000000000..f6ed2f40a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ptrmem.C @@ -0,0 +1,20 @@ +// { dg-options -std=c++0x } + +struct C { // literal type + int m; + int n; + constexpr C(int m) : m(m), n(-m) {} + constexpr bool is_neg() { return m < 0; } +}; + +constexpr bool check1(const C& c, int C:: *pm) { return c.*pm < 0; } // #1 + +constexpr bool check2(const C* pc, bool (C::*pm)() const) { return +(pc->*pm)(); } // #2 + +constexpr C c(-1); + +static_assert(!check1(c, &C::n), "Error"); +static_assert(check1(c, &C::m), "Error"); + +static_assert(check2(&c, &C::is_neg), "Error"); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-pure.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-pure.C new file mode 100644 index 000000000..e17e02a42 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-pure.C @@ -0,0 +1,13 @@ +// { dg-options -std=c++0x } + +struct A +{ + virtual void f() = 0; +}; + +struct B: A +{ + void f() { } +}; + +B b; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C new file mode 100644 index 000000000..2f9b4887d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C @@ -0,0 +1,5 @@ +// Test that we catch excessive recursion. +// { dg-options "-std=c++0x -fconstexpr-depth=5" } +// { dg-prune-output "in constexpr expansion" } +constexpr int f (int i) { return f (i-1); } +constexpr int i = f(42); // { dg-error "constexpr evaluation depth" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-sassert.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-sassert.C new file mode 100644 index 000000000..3e08fb0ef --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-sassert.C @@ -0,0 +1,13 @@ +// Allow static_assert in constexpr constructors, too. +// { dg-options -std=c++0x } + +template +struct A +{ + int i; + + constexpr A(int i) : i(i) + { + static_assert(sizeof(T) == 1, ""); + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-static.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-static.C new file mode 100644 index 000000000..8ed2b5e82 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-static.C @@ -0,0 +1,24 @@ +// Test for constant initialization of non-literal class (e.g. mutex) +// { dg-options "-std=c++0x -save-temps" } +// { dg-do run } + +struct A +{ + int i; + constexpr A(int _i): i(_i) { } + A(const A&); // non-trivial copy ctor makes A non-literal +}; + +A a(42); // constexpr constructor allows constant initialization +A ar[3] = { { 1 }, { 2 }, { 3 } }; +// { dg-final { scan-assembler-not "static_initialization" } } +// { dg-final cleanup-saved-temps } + +int main() +{ + if (a.i != 42 + || ar[0].i != 1 + || ar[1].i != 2 + || ar[2].i != 3) + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-static2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-static2.C new file mode 100644 index 000000000..67c353080 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-static2.C @@ -0,0 +1,11 @@ +// { dg-options -std=c++0x } +struct IsLiteral {}; + +struct ShouldBeLiteral { + constexpr ShouldBeLiteral(int){} +}; + +struct StaticDataMember { + static constexpr IsLiteral one = IsLiteral(); // #1 + static constexpr ShouldBeLiteral two= ShouldBeLiteral(-1); // #2 +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C new file mode 100644 index 000000000..dccdc854b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C @@ -0,0 +1,18 @@ +// Test for constant initialization of class with vtable +// { dg-options "-std=c++0x -save-temps" } +// { dg-final { scan-assembler-not "static_initialization" } } +// { dg-final cleanup-saved-temps } +// { dg-do run } + +int r = 1; +// implicit default constructor for A and B is constexpr +struct A { virtual void f() {} }; +struct B: A { virtual void f() { r = 0; } }; + +B b; + +int main() +{ + b.f(); + return r; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-static4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-static4.C new file mode 100644 index 000000000..8189fc5de --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-static4.C @@ -0,0 +1,20 @@ +// { dg-options -std=c++0x } +// { dg-do run } + +extern "C" void abort (); +extern int ar[2]; + +int f() +{ + if (ar[0] != 42 || ar[1] != 0) + abort (); + return 1; +} + +int i = f(); + +int ar[2] = { 42, i }; + +int main() +{ +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-static5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-static5.C new file mode 100644 index 000000000..a401cc0b8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-static5.C @@ -0,0 +1,17 @@ +// { dg-options -std=c++0x } + +template +struct A +{ + constexpr static T t = T(); // { dg-error "literal" } +}; +template +constexpr T A::t; + +struct B +{ + ~B(); +}; + +B b = A::t; + diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-static6.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-static6.C new file mode 100644 index 000000000..a34704d83 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-static6.C @@ -0,0 +1,21 @@ +// { dg-options -std=c++0x } + +struct B +{ + constexpr operator int() { return 4; } +}; + +template +struct C; + +template<> +struct C<4> { typedef int TP; }; + +template +struct A +{ + constexpr static B t = B(); + C::TP tp; +}; + +A a; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-static7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-static7.C new file mode 100644 index 000000000..ba4a25184 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-static7.C @@ -0,0 +1,8 @@ +// PR c++/48945 +// { dg-options -std=c++0x } + +struct A { + static constexpr bool is(); +}; + +constexpr bool A::is() { return true; } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-stmtexpr.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-stmtexpr.C new file mode 100644 index 000000000..40e0c2d65 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-stmtexpr.C @@ -0,0 +1,8 @@ +// PR c++/46977 +// { dg-options "-std=c++0x" } + +template < typename > void +foo () +{ + ({int i;}), 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-string.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-string.C new file mode 100644 index 000000000..e76d00d7e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-string.C @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } + +constexpr char c1 = "hi"[1]; +constexpr char c2 = "hi"[2]; +constexpr char c3 = "hi"[3]; // { dg-error "out of bound" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-switch.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-switch.C new file mode 100644 index 000000000..d229304e4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-switch.C @@ -0,0 +1,13 @@ +// { dg-options -std=c++0x } + +template +constexpr T value(T t = T()) { return t; } + +enum us_enum { us_item = value() }; // OK + +void func(us_enum n) { + switch (n) { + case value(us_item): ; // #1 Error + default: ; + } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C new file mode 100644 index 000000000..55cf2ad7c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-switch2.C @@ -0,0 +1,23 @@ +// Test for constexpr conversion in case context +// { dg-options -std=c++0x } + +enum class E { e1, e2 }; + +struct A +{ + E e; + constexpr operator E() { return e; } + constexpr A(E e): e(e) { } +}; + +E e; + +int main() +{ + switch (e) + { + case A(E::e1): + case A(E::e2): + ; + } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-synth1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-synth1.C new file mode 100644 index 000000000..983093980 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-synth1.C @@ -0,0 +1,14 @@ +// PR c++/46472 +// { dg-options -std=c++0x } + +template struct A { + T t; + constexpr A(){} +}; + +struct B +{ + A a; +}; + +B b; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-targ.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-targ.C new file mode 100644 index 000000000..0c8c73d2e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-targ.C @@ -0,0 +1,13 @@ +// { dg-options -std=c++0x } + +struct A +{ + constexpr operator double() { return 1.0; } +}; + +template +struct B +{ }; + +constexpr A a { }; +B b; // { dg-error "template argument|invalid type" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C new file mode 100644 index 000000000..f1ef9dc7d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C @@ -0,0 +1,8 @@ +// { dg-options -std=c++0x } + +constexpr int may_throw(bool decide) { + return decide ? 42 : throw -1; // { dg-error "throw" } +} + +constexpr int x = may_throw(false); // { dg-message "may_throw" } +constexpr int y = may_throw(true); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C new file mode 100644 index 000000000..2719e3aea --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C @@ -0,0 +1,11 @@ +// PR c++/50508 +// { dg-options -std=c++0x } + +template + struct integral_constant { + typedef T value_type; + constexpr operator value_type() { return true; } + }; + +static constexpr bool value = integral_constant() + && true; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-typeid.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-typeid.C new file mode 100644 index 000000000..b523bb38c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-typeid.C @@ -0,0 +1,10 @@ +// { dg-options -std=c++0x } + +#include + +struct A { virtual void f(); }; + +extern constexpr const std::type_info* p1 = &typeid(int); +extern constexpr const std::type_info* p2 = &typeid(A); +// typeid-expression whose operand is of a polymorphic class type +extern constexpr const std::type_info* p3 = &typeid((A())); // { dg-error "" "" { xfail *-*-* } } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-union.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-union.C new file mode 100644 index 000000000..b4613058e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-union.C @@ -0,0 +1,16 @@ +// Test that we don't have to deal with type punning +// FIXME Mike Miller thinks it should work +// { dg-options -std=c++0x } + +union U +{ + float f; + unsigned char ca[sizeof(float)]; +}; + +constexpr U u = { 1.0 }; +constexpr float f = u.f; +constexpr unsigned char c = u.ca[0]; // { dg-error "U::ca" } + +constexpr double d = 1.0; +constexpr unsigned char c2 = (unsigned char&)d; // { dg-error "char. glvalue" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-value.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-value.C new file mode 100644 index 000000000..85799d90b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-value.C @@ -0,0 +1,10 @@ +// { dg-options -std=c++0x } + +struct HopefullyLiteral { + HopefullyLiteral() = default; // Should be a constexpr c'tor as of 12.1/6 and 8.4.2/4 +}; + +constexpr HopefullyLiteral var1{}; // OK +constexpr HopefullyLiteral var2 = HopefullyLiteral{}; // #1 +constexpr HopefullyLiteral var3 = HopefullyLiteral(); // #2 +constexpr HopefullyLiteral var4 = HopefullyLiteral(var3); // #3 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-value2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-value2.C new file mode 100644 index 000000000..1b0e28f16 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-value2.C @@ -0,0 +1,19 @@ +// { dg-options -std=c++0x } + +template +constexpr T value_init() { return T(); } + +template +constexpr inline T bar(T x) { return x; } + +union EmptyUnion {}; +union Union1 { int i; }; +union Union3 { double d; int i; char* c; }; + +constexpr auto u1 = value_init(); +constexpr auto u2 = value_init(); +constexpr auto u3 = value_init(); +constexpr auto u4 = bar(EmptyUnion{}); +constexpr auto u5 = bar(Union1{}); +constexpr auto u6 = bar(Union3{}); +constexpr auto u7 = bar(u1); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-value3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-value3.C new file mode 100644 index 000000000..38d89936e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-value3.C @@ -0,0 +1,10 @@ +// PR c++/50234 +// { dg-options -std=c++0x } + +#define SA(X) static_assert((X),#X) + +struct A { int i; }; + +constexpr int f(A a) { return a.i; } + +SA(f({}) == 0); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-variadic.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-variadic.C new file mode 100644 index 000000000..5d0ad0594 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-variadic.C @@ -0,0 +1,9 @@ +// { dg-options -std=c++0x } +template +constexpr bool variadics(T&&...) { return true; } + +struct IsLiteral {}; + +constexpr bool variadic_var = variadics(0, true, 1.2, IsLiteral{}); // Error, so below + +int main() {} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual.C new file mode 100644 index 000000000..448ecb1dc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual.C @@ -0,0 +1,14 @@ +// PR c++/47067 +// { dg-options -std=c++0x } + +struct X { + virtual void x(); + virtual ~X(); +}; + +struct Y { + virtual void y(); + virtual ~Y(); +}; + +struct Z: X, Y {} z; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C new file mode 100644 index 000000000..059977bff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C @@ -0,0 +1,34 @@ +// PR c++/48570 +// { dg-do run } +// { dg-options "-std=c++0x" } + +extern "C" void abort (); +constexpr wchar_t foo (int i) { return L"0123"[i]; } +constexpr char16_t bar (int i) { return u"0123"[i]; } +constexpr char32_t baz (int i) { return U"0123"[i]; } +const wchar_t foo0 = foo (0); +const wchar_t foo1 = foo (1); +const wchar_t foo2 = foo (2); +const wchar_t foo3 = foo (3); +const wchar_t foo4 = foo (4); +const char16_t bar0 = bar (0); +const char16_t bar1 = bar (1); +const char16_t bar2 = bar (2); +const char16_t bar3 = bar (3); +const char16_t bar4 = bar (4); +const char32_t baz0 = baz (0); +const char32_t baz1 = baz (1); +const char32_t baz2 = baz (2); +const char32_t baz3 = baz (3); +const char32_t baz4 = baz (4); + +int +main () +{ + if (foo0 != L'0' || foo1 != L'1' || foo2 != L'2' || foo3 != L'3' || foo4 != L'\0') + abort (); + if (bar0 != u'0' || bar1 != u'1' || bar2 != u'2' || bar3 != u'3' || bar4 != u'\0') + abort (); + if (baz0 != U'0' || baz1 != U'1' || baz2 != U'2' || baz3 != U'3' || baz4 != U'\0') + abort (); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C new file mode 100644 index 000000000..4fc8980ef --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C @@ -0,0 +1,7 @@ +// PR c++/48570 +// { dg-do compile } +// { dg-options -std=c++0x } + +constexpr wchar_t c1 = L"hi"[3]; // { dg-error "out of bound" } +constexpr char16_t c2 = u"hi"[3]; // { dg-error "out of bound" } +constexpr char32_t c3 = U"hi"[3]; // { dg-error "out of bound" } diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-33837.C b/gcc/testsuite/g++.dg/cpp0x/decltype-33837.C new file mode 100644 index 000000000..2c263dd0a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-33837.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++0x } +// PR c++/33837 +void foo() +{ + __decltype (A::foo()); // { dg-error "was not declared|expected" } + __decltype (B); // { dg-error "was not declared" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-33838.C b/gcc/testsuite/g++.dg/cpp0x/decltype-33838.C new file mode 100644 index 000000000..260a0d1cf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-33838.C @@ -0,0 +1,6 @@ +// { dg-options -std=c++0x } +// PR c++/33838 +template struct A +{ + __decltype (T* foo()); // { dg-error "expected|no arguments|accept" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-38655.C b/gcc/testsuite/g++.dg/cpp0x/decltype-38655.C new file mode 100644 index 000000000..3b8455bc1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-38655.C @@ -0,0 +1,4 @@ +// PR c++/38655 +// { dg-options "" } + +__decltype(0r)* p = 1; // { dg-error "not supported|invalid" } diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-refbug.C b/gcc/testsuite/g++.dg/cpp0x/decltype-refbug.C new file mode 100644 index 000000000..8e3c82407 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-refbug.C @@ -0,0 +1,17 @@ +// { dg-options "-std=c++0x" } +// PR c++/33045 +int && f (); + +template +struct is_same +{ + static const bool value = false; +}; + +template +struct is_same +{ + static const bool value = true; +}; + +static_assert(is_same::value, "decltype of rvalue reference"); diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype1.C b/gcc/testsuite/g++.dg/cpp0x/decltype1.C new file mode 100644 index 000000000..d1288e07d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype1.C @@ -0,0 +1,28 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +template +struct is_same +{ + static const bool value = false; +}; + +template +struct is_same +{ + static const bool value = true; +}; + +const int& foo(); +int i; +struct A { double x; }; +const A* a = new A(); + +static_assert(is_same::value, + "type should be const int&"); +static_assert(is_same::value, + "type should be int"); +static_assert(is_samex), double>::value, + "type should be double"); +static_assert(is_samex)), const double&>::value, + "type should be const double&"); diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype10.C b/gcc/testsuite/g++.dg/cpp0x/decltype10.C new file mode 100644 index 000000000..6c488998c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype10.C @@ -0,0 +1,10 @@ +// PR c++/34271 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template struct A +{ + static int i; +}; + +template int A::i(decltype (A::i; // { dg-error "expected primary-expression before" } diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype11.C b/gcc/testsuite/g++.dg/cpp0x/decltype11.C new file mode 100644 index 000000000..ac32d349a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype11.C @@ -0,0 +1,12 @@ +// PR c++/35316 +// { dg-options "-std=c++0x" } + +template struct A +{ + int i : 2; + + void foo() + { + decltype(i) j; + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype12.C b/gcc/testsuite/g++.dg/cpp0x/decltype12.C new file mode 100644 index 000000000..77c794bcf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype12.C @@ -0,0 +1,38 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +template +struct is_same +{ + static const bool value = false; +}; + +template +struct is_same +{ + static const bool value = true; +}; + +int&& f(const int&) {} +int&& (*fp)(const int&) = f; +int&& (&fr)(const int&) = f; + +struct X { int&& f(const int&); }; + +int&& (X::*mfp)(const int&) = &X::f; + +void g(X& xr, X* xp) +{ + int i; + static_assert(is_same::value, "direct call"); + static_assert(is_same::value, "pointer"); + static_assert(is_same::value, + "dereferenced pointer"); + static_assert(is_same::value, + "reference"); + static_assert(is_same::value, + "member function call"); + static_assert(is_same::value, + "member function pointer with .*"); + static_assert(is_same*mfp)(i)), int&&>::value, + "member function pointer with ->*"); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype13.C b/gcc/testsuite/g++.dg/cpp0x/decltype13.C new file mode 100644 index 000000000..8e6c6d2bf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype13.C @@ -0,0 +1,38 @@ +// PR c++/34269 +// { dg-do compile } + +void +f1 () +{ + __decltype; // { dg-error "expected" } +} + +void +f2 () +{ + __decltype (; // { dg-error "expected" } +} + +void +f3 () +{ + __decltype (); // { dg-error "expected" } +} + +void +f4 () +{ + __typeof__; // { dg-error "expected" } +} + +void +f5 () +{ + __typeof__ (; // { dg-error "expected" } +} + +void +f6 () +{ + __typeof__ (); // { dg-error "expected" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype14.C b/gcc/testsuite/g++.dg/cpp0x/decltype14.C new file mode 100644 index 000000000..9484173cd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype14.C @@ -0,0 +1,17 @@ +// PR c++/37540 + +struct A +{ + int g() {return 0;} +}; + +template +void f(A a) +{ + __decltype(a.g()) i; +} + +int main() +{ + f(A()); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype15.C b/gcc/testsuite/g++.dg/cpp0x/decltype15.C new file mode 100644 index 000000000..5c2d445de --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype15.C @@ -0,0 +1,13 @@ +// PR c++/38640 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template void foo (decltype (N)); +template void foo (decltype (N)); + +void +bar (void) +{ + foo<5> (6); + foo<5L> (6L); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype16.C b/gcc/testsuite/g++.dg/cpp0x/decltype16.C new file mode 100644 index 000000000..2002458b8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype16.C @@ -0,0 +1,10 @@ +// PR c++/39070 +// { dg-options "-std=c++0x" } + +template struct junk { + template static Z y(); + template static int test(...); + template static char test(decltype(y())*); + static int const value=sizeof(test(0)); +}; +typedef char type[junk::value==sizeof(char) ? 1 : -1]; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype17.C b/gcc/testsuite/g++.dg/cpp0x/decltype17.C new file mode 100644 index 000000000..3c98105fc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype17.C @@ -0,0 +1,29 @@ +// PR c++/36628 +// { dg-options "-std=c++0x" } +// { dg-do run } + +#include +#include + +int rvalue(); +int& lvalueref(); +int&& rvalueref(); + +decltype(true ? rvalue() : rvalue()) f() +{} + +decltype(true ? lvalueref() : lvalueref()) g() +{} + +decltype(true ? rvalueref() : rvalueref()) h() +{} + +int main() +{ + if (strcmp (typeid(f).name(), "FivE") != 0) + return 1; + if (strcmp (typeid(g).name(), "FRivE") != 0) + return 2; + if (strcmp (typeid(h).name(), "FivE") != 0) + return 3; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype18.C b/gcc/testsuite/g++.dg/cpp0x/decltype18.C new file mode 100644 index 000000000..0d44586e9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype18.C @@ -0,0 +1,5 @@ +// PR c++/37875 +// { dg-options "-std=c++0x" } + +template struct X {}; +X 2)> x; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype19.C b/gcc/testsuite/g++.dg/cpp0x/decltype19.C new file mode 100644 index 000000000..41d602f34 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype19.C @@ -0,0 +1,24 @@ +// PR c++/42013 + +template + _Tp +__attribute ((const)) declval(); + +template + struct common_type + { + typedef __decltype(true ? declval<_Tp>() : declval<_Up>()) typet; + typedef __decltype(false ? declval<_Tp>() : declval<_Up>()) typef; + }; + +template struct is_same; + +template struct is_same<_Tp, _Tp> { typedef _Tp type; }; + +void f() +{ + typedef common_type::typet typet; + typedef common_type::typef typef; + + typedef is_same::type type; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype2.C b/gcc/testsuite/g++.dg/cpp0x/decltype2.C new file mode 100644 index 000000000..186d75b72 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype2.C @@ -0,0 +1,59 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +template +struct is_same +{ + static const bool value = false; +}; + +template +struct is_same +{ + static const bool value = true; +}; + +#define CHECK_DECLTYPE(DECLTYPE,RESULT) \ + static_assert(is_same< DECLTYPE , RESULT >::value, #RESULT) + +struct A {}; + +int a; +int& b = a; +const int& c = a; +const int d = 5; +const A e = A(); +CHECK_DECLTYPE(decltype(a), int); +CHECK_DECLTYPE(decltype(b), int&); +CHECK_DECLTYPE(decltype(c), const int&); +CHECK_DECLTYPE(decltype(d), const int); +CHECK_DECLTYPE(decltype(e), const A); + +CHECK_DECLTYPE(decltype(a), int); +CHECK_DECLTYPE(decltype((a)), int&); + +void foo_check(int a, int& b, float& c, int* d) +{ + CHECK_DECLTYPE(decltype(a), int); + CHECK_DECLTYPE(decltype(b), int&); + CHECK_DECLTYPE(decltype(c), float&); + CHECK_DECLTYPE(decltype(d), int*); +} + +int foo(char); +int bar(char); +int bar(int); +CHECK_DECLTYPE(decltype(foo), int(char)); + +decltype(bar) z; // { dg-error "overload" } +// { dg-error "invalid type" "" { target *-*-* } 48 } + +CHECK_DECLTYPE(decltype(&foo), int(*)(char)); +CHECK_DECLTYPE(decltype(*&foo), int(&)(char)); + +void array_types() +{ + int a[10]; + CHECK_DECLTYPE(decltype(a), int[10]); +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype20.C b/gcc/testsuite/g++.dg/cpp0x/decltype20.C new file mode 100644 index 000000000..3155cdcf8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype20.C @@ -0,0 +1,10 @@ +// PR c++/42277 +// { dg-options -std=c++0x } + +struct S { int s; }; +template +void foo () +{ + S s; + decltype (s.s) i; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype22.C b/gcc/testsuite/g++.dg/cpp0x/decltype22.C new file mode 100644 index 000000000..74811cfe7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype22.C @@ -0,0 +1,13 @@ +// PR c++/42761 +// { dg-options "-std=c++0x" } + +template _Tp* fn(); + +template struct A +{ + template ())> + struct B { }; +}; + +A a; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype23.C b/gcc/testsuite/g++.dg/cpp0x/decltype23.C new file mode 100644 index 000000000..78eb89d8e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype23.C @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } + +int x, &&y = static_cast(x); +typedef decltype((y)) myInt; // `y' is a parenthesized id-expression of type int that is an lvalue +typedef int &myInt; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype24.C b/gcc/testsuite/g++.dg/cpp0x/decltype24.C new file mode 100644 index 000000000..16d0736d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype24.C @@ -0,0 +1,7 @@ +// PR c++/47068 +// { dg-options -std=c++0x } + +template struct broken { + int member; + typedef decltype(~ member) gcc_crashes_here; +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype25.C b/gcc/testsuite/g++.dg/cpp0x/decltype25.C new file mode 100644 index 000000000..c9559f151 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype25.C @@ -0,0 +1,20 @@ +// PR c++/47851 +// { dg-options -std=c++0x } + +struct Type { + void display_type(); + void display_type() const { } +}; + +typedef Type const ConstType; + +struct ConvertibleToType { + operator Type&() { return *reinterpret_cast(this); } +}; + +int main () +{ + // Both lines should call the const variant. + (true ? ConvertibleToType() : ConstType()).display_type(); + decltype((true ? ConvertibleToType() : ConstType()))().display_type(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype27.C b/gcc/testsuite/g++.dg/cpp0x/decltype27.C new file mode 100644 index 000000000..cb962ada5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype27.C @@ -0,0 +1,9 @@ +// PR c++/48617 +// { dg-options -std=c++0x } + +template // # +struct A {}; + +A a; + +int main() {} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype3.C b/gcc/testsuite/g++.dg/cpp0x/decltype3.C new file mode 100644 index 000000000..aeacfae09 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype3.C @@ -0,0 +1,72 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +template +struct is_same +{ + static const bool value = false; +}; + +template +struct is_same +{ + static const bool value = true; +}; + +#define CHECK_DECLTYPE(DECLTYPE,RESULT) \ + static_assert(is_same< DECLTYPE , RESULT >::value, #DECLTYPE " should be " #RESULT) + +class A { +public: + int a; + int& b; + static int c; + + A(int& b) : b(b) { } + + void foo() { + CHECK_DECLTYPE(decltype(a), int); + CHECK_DECLTYPE(decltype(this->a), int); + CHECK_DECLTYPE(decltype((*this).a), int); + CHECK_DECLTYPE(decltype(b), int&); + CHECK_DECLTYPE(decltype(c), int); + } + void bar() const { + CHECK_DECLTYPE(decltype(a), int); + CHECK_DECLTYPE(decltype(b), int&); + CHECK_DECLTYPE(decltype(c), int); + } +}; + +int b; +A aa(b); +const A& caa = aa; +CHECK_DECLTYPE(decltype(aa.a), int); +CHECK_DECLTYPE(decltype(aa.b), int&); +CHECK_DECLTYPE(decltype(caa.a), int); + +class B { +public: + int a; + enum B_enum { b }; + decltype(a) c; + decltype(a) foo() { } + decltype(b) enums_are_in_scope() { return b; } // ok +}; + +CHECK_DECLTYPE(decltype(aa.*&A::a), int&); +decltype(aa.*&A::b) zz; // { dg-error "cannot create pointer to reference member" } +// { dg-error "invalid type" "" { target *-*-* } 58 } +CHECK_DECLTYPE(decltype(caa.*&A::a), const int&); + +class X { + void foo() { + CHECK_DECLTYPE(decltype(this), X*); + CHECK_DECLTYPE(decltype(*this), X&); + } + void bar() const { + CHECK_DECLTYPE(decltype(this), const X*); + CHECK_DECLTYPE(decltype(*this), const X&); + } +}; + diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype30.C b/gcc/testsuite/g++.dg/cpp0x/decltype30.C new file mode 100644 index 000000000..b23c9a94d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype30.C @@ -0,0 +1,17 @@ +// PR c++/49369 +// { dg-options -std=c++0x } + +template struct assert_same; +template struct assert_same {}; + +struct B { + int member; +}; + +struct C: B { + void method() const; +}; + +void C::method() const { + assert_same a; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype31.C b/gcc/testsuite/g++.dg/cpp0x/decltype31.C new file mode 100644 index 000000000..b9817eb9e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype31.C @@ -0,0 +1,13 @@ +// PR c++/49921 +// { dg-options -std=c++0x } + +struct Local +{ + void f(); +}; + +Local *l; +void (Local::*ptr)(); +decltype((l->*ptr)) i; // { dg-error "member function" } + +// { dg-prune-output "invalid type in declaration" } diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype35.C b/gcc/testsuite/g++.dg/cpp0x/decltype35.C new file mode 100644 index 000000000..d1fd47638 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype35.C @@ -0,0 +1,15 @@ +// PR c++/50870 +// { dg-options -std=c++0x } + +template + struct impl + { + template static T create(); + }; + +template ::template create() + -> impl::template create())> +struct tester { }; + +tester*, int, float> ti; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype36.C b/gcc/testsuite/g++.dg/cpp0x/decltype36.C new file mode 100644 index 000000000..f3dfed992 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype36.C @@ -0,0 +1,21 @@ +// PR c++/51265 +// { dg-options -std=c++0x } + +struct Funny +{ + int print(int); +}; + +template +void c(); + +template +void xx() +{ + c(); +} + +int main() +{ + xx(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype4.C b/gcc/testsuite/g++.dg/cpp0x/decltype4.C new file mode 100644 index 000000000..cd715cb28 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype4.C @@ -0,0 +1,83 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +template +struct is_same +{ + static const bool value = false; +}; + +template +struct is_same +{ + static const bool value = true; +}; + +#define CHECK_DECLTYPE(DECLTYPE,RESULT) \ + static_assert(is_same< DECLTYPE , RESULT >::value, #DECLTYPE " should be " #RESULT) + +struct A { + int x; + int& y; + int foo(char); + int& bar() const; +}; + +CHECK_DECLTYPE(decltype(&A::x), int A::*); +decltype(&A::y) Ay; // { dg-error "cannot create pointer to reference member|invalid type" } +CHECK_DECLTYPE(decltype(&A::foo), int (A::*) (char)); +CHECK_DECLTYPE(decltype(&A::bar), int& (A::*) () const); + +CHECK_DECLTYPE(decltype("decltype"), const char(&)[9]); +CHECK_DECLTYPE(decltype(1), int); + +int an_int = 5; +int& i = an_int; +const int j = an_int; + +CHECK_DECLTYPE(decltype(i)&, int&); +CHECK_DECLTYPE(const decltype(j), const int); + +int foo(); +CHECK_DECLTYPE(decltype(foo()), int); +float& bar(int); +CHECK_DECLTYPE(decltype (bar(1)), float&); +const A bar(); +CHECK_DECLTYPE(decltype (bar()), const A); +const A& bar2(); +CHECK_DECLTYPE(decltype (bar2()), const A&); + +void wibble() { + CHECK_DECLTYPE(decltype(1+2), int); + int* p; + CHECK_DECLTYPE(decltype(*p), int&); + int a[10]; + CHECK_DECLTYPE(decltype(a[3]), int&); + int i; int& j = i; + CHECK_DECLTYPE(decltype (i = 5), int&); + CHECK_DECLTYPE(decltype (j = 5), int&); + + CHECK_DECLTYPE(decltype (++i), int&); + CHECK_DECLTYPE(decltype (i++), int); +} + +struct B { + B () : bit(), cbit() {} + int bit : 2; + const int cbit : 3; + + void foo() + { + CHECK_DECLTYPE(decltype(bit), int); + CHECK_DECLTYPE(decltype((bit)), int&); + CHECK_DECLTYPE(decltype(cbit), const int); + CHECK_DECLTYPE(decltype((cbit)), const int&); + } +}; + +B b; +const B& bc = b; +CHECK_DECLTYPE(decltype(b.bit), int); +CHECK_DECLTYPE(decltype(bc.bit), int); +CHECK_DECLTYPE(decltype((b.bit)), int&); +CHECK_DECLTYPE(decltype((bc.bit)), const int&); diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype5.C b/gcc/testsuite/g++.dg/cpp0x/decltype5.C new file mode 100644 index 000000000..139153987 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype5.C @@ -0,0 +1,38 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +template +struct is_same +{ + static const bool value = false; +}; + +template +struct is_same +{ + static const bool value = true; +}; + +#define CHECK_DECLTYPE(DECLTYPE,RESULT) \ + static_assert(is_same< DECLTYPE , RESULT >::value, #RESULT) + +template F create_a(); + +template +decltype(create_a()(create_a())) forward(F f, const T1& a1) +{ + return f(a1); +} + +struct identity { + template + const T& operator()(const T& x) { return x; } +}; + + +identity id; +int i; +float f; + +CHECK_DECLTYPE(decltype(forward(id, i)), const int&); +CHECK_DECLTYPE(decltype(forward(id, f)), const float&); diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype6.C b/gcc/testsuite/g++.dg/cpp0x/decltype6.C new file mode 100644 index 000000000..7aa8e1505 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype6.C @@ -0,0 +1,36 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +template +struct is_same +{ + static const bool value = false; +}; + +template +struct is_same +{ + static const bool value = true; +}; + +template const T& foo(); + + +int i; + +template +struct A +{ + double x; +}; + +const A* a = new A(); + +static_assert(is_same()), const int&>::value, + "type should be const int&"); +static_assert(is_same::value, + "type should be int"); +static_assert(is_samex), double>::value, + "type should be double"); +static_assert(is_samex)), const double&>::value, + "type should be const double&"); diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype7.C b/gcc/testsuite/g++.dg/cpp0x/decltype7.C new file mode 100644 index 000000000..f757c9e10 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype7.C @@ -0,0 +1,14 @@ +// PR c++/34268 +// { dg-do compile } + +struct A +{ + __decltype (A); // { dg-error "must be an expression" } + __decltype (~A); // { dg-error "must be an expression" } +}; + +struct B +{ + __typeof__ (B); + __typeof__ (~B); // { dg-error "expected primary-expression" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype8.C b/gcc/testsuite/g++.dg/cpp0x/decltype8.C new file mode 100644 index 000000000..368068926 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype8.C @@ -0,0 +1,12 @@ +// PR c++/34267 +// { dg-do compile } + +struct A {}; +__decltype (A); // { dg-error "must be an expression" } +template struct B +{ + __decltype (A); // { dg-error "must be an expression" } + __decltype (~A); // { dg-error "must be an expression" } + __decltype (B); // { dg-error "must be an expression" } + __decltype (~B); // { dg-error "must be an expression" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype9.C b/gcc/testsuite/g++.dg/cpp0x/decltype9.C new file mode 100644 index 000000000..4cd150ea6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype9.C @@ -0,0 +1,10 @@ +// PR c++/34271 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template struct A +{ + static int i; +}; + +template int A::i(decltype (A::i)); // { dg-error "member function|must be an expression" } diff --git a/gcc/testsuite/g++.dg/cpp0x/deduce.C b/gcc/testsuite/g++.dg/cpp0x/deduce.C new file mode 100644 index 000000000..635228cca --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/deduce.C @@ -0,0 +1,36 @@ +// { dg-options "--std=c++0x" } +template struct same_type; +template struct same_type {}; + +int lval_int; +int rval_int(); +int const lval_const_int=0; +int const&& rval_const_int(); + +template void deduce_lval_int(T && t) +{ + same_type(); +} + +template void deduce_rval_int(T && t) +{ + same_type(); +} + +template void deduce_lval_const_int(T && t) +{ + same_type(); +} + +template void deduce_rval_const_int(T && t) +{ + same_type(); +} + +void f() +{ + deduce_lval_int(lval_int); + deduce_rval_int(rval_int()); + deduce_lval_const_int(lval_const_int); + deduce_rval_const_int(rval_const_int()); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted1.C b/gcc/testsuite/g++.dg/cpp0x/defaulted1.C new file mode 100644 index 000000000..e8fe37eb3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted1.C @@ -0,0 +1,43 @@ +// Positive test for defaulted/deleted fns +// { dg-do run } +// { dg-options "-std=c++0x" } + +struct A +{ + int i; + A() = default; + A(const A&) = delete; + A& operator=(const A&) = default; + ~A(); +}; + +A::~A() = default; + +void f() = delete; + +struct B +{ + int i; + B() = default; +}; + +int main() +{ + A a1, a2; + B b = {1}; + a1 = a2; +} + +// fns defaulted in class defn are trivial +struct C +{ + C() = default; + C(const C&) = default; + C& operator=(const C&) = default; + ~C() = default; +}; + +union U +{ + C c; +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted10.C b/gcc/testsuite/g++.dg/cpp0x/defaulted10.C new file mode 100644 index 000000000..64fa5f019 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted10.C @@ -0,0 +1,14 @@ +// PR c++/40381 +// { dg-options "-std=gnu++0x" } + +struct A +{ + template void foo(T) = delete; // { dg-error "previously|declared" } +}; + +template void A::foo(T) {} // { dg-error "redefinition" } + +void bar() +{ + A().foo(0); // { dg-error "use" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted11.C b/gcc/testsuite/g++.dg/cpp0x/defaulted11.C new file mode 100644 index 000000000..b9bed7e00 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted11.C @@ -0,0 +1,15 @@ +// Core issue 901 +// { dg-options "-std=c++0x" } + +struct A +{ + A(); ~A(); + void operator delete (void *) = delete; + void operator delete[] (void *) = delete; +}; + +int main() +{ + A* ap = new A; + ap = new A[2]; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted13.C b/gcc/testsuite/g++.dg/cpp0x/defaulted13.C new file mode 100644 index 000000000..8b2357921 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted13.C @@ -0,0 +1,29 @@ +// { dg-options -std=c++0x } + +template +struct NonCopyable { + NonCopyable() = default; + NonCopyable(NonCopyable const&); +}; + +template<> +NonCopyable::NonCopyable(NonCopyable const&) = delete; // { dg-error "declared" } + +template +NonCopyable::NonCopyable(NonCopyable const&) = default; + +template<> +NonCopyable::NonCopyable(NonCopyable const&) = delete; // { dg-error "declared" } + + +int main() +{ + NonCopyable nc_dbl; + NonCopyable nc_dbl_cpy(nc_dbl); // { dg-error "use" } + + NonCopyable nc_int; + NonCopyable nc_int_cpy(nc_int); // { dg-error "use" } + + NonCopyable nc_char; + NonCopyable nc_char_cpy(nc_char); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted14.C b/gcc/testsuite/g++.dg/cpp0x/defaulted14.C new file mode 100644 index 000000000..e476d576c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted14.C @@ -0,0 +1,20 @@ +// PR c++/39866 +// { dg-options "-std=c++0x" } + +struct A { + A& operator=(const A&) = delete; // { dg-bogus "" } + + void operator=(int) {} // { dg-message "" } + void operator=(char) {} // { dg-message "" } +}; + +struct B {}; + +int main() +{ + A a; + a = B(); // { dg-error "no match" } + // { dg-message "candidate" "candidate note" { target *-*-* } 16 } + a = 1.0; // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 18 } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted15.C b/gcc/testsuite/g++.dg/cpp0x/defaulted15.C new file mode 100644 index 000000000..4c5b11c9e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted15.C @@ -0,0 +1,58 @@ +// PR c++/38796 +// { dg-options -std=c++0x } + +#define SA(X) static_assert ((X), #X) + +struct A +{ + A (int); + A (const A& = 1) = default; // { dg-error "default argument" } + void operator= (const A&) = default; // { dg-error "defaulted|match" } +}; + +struct B +{ +private: + B() = default; +}; + +SA(__has_trivial_constructor(B)); + +struct C +{ +protected: + ~C() = default; +}; + +SA(__has_trivial_destructor(C)); + +struct D +{ +private: + D& operator= (const D&) = default; +}; + +SA(__has_trivial_assign(D)); + +struct E +{ + explicit E (const E&) = default; +}; + +SA(__has_trivial_copy(E)); + +struct F +{ + F(F&) = default; // { dg-error "non-const" } +}; + +struct G: public F +{ + // Can't be const because F copy ctor isn't. + G(const G&) = default; // { dg-error "const" } +}; + +struct H +{ + virtual ~H() = default; // { dg-error "declared virtual" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted16.C b/gcc/testsuite/g++.dg/cpp0x/defaulted16.C new file mode 100644 index 000000000..741b43de2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted16.C @@ -0,0 +1,13 @@ +// Test that non-inline default causes the function to be defined even if +// it isn't used. + +// { dg-options -std=c++0x } +// { dg-final { scan-assembler "_ZN1AC1Ev" } } + +struct A +{ + A(); +}; + +A::A() = default; + diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted17.C b/gcc/testsuite/g++.dg/cpp0x/defaulted17.C new file mode 100644 index 000000000..79e91a0eb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted17.C @@ -0,0 +1,12 @@ +// { dg-options -std=c++0x } + +struct A // { dg-error "const|operator=" } +{ + const int i; +}; + +int main() +{ + A a = { 0 }; + a = a; // { dg-error "deleted" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted18.C b/gcc/testsuite/g++.dg/cpp0x/defaulted18.C new file mode 100644 index 000000000..559dfde48 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted18.C @@ -0,0 +1,10 @@ +// { dg-options "-std=c++0x" } + +void f(char i, int j) = delete; // { dg-message "" } +void f(int i, ...); // { dg-message "void f" } + +int main() +{ + f(1,1); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 8 } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted19.C b/gcc/testsuite/g++.dg/cpp0x/defaulted19.C new file mode 100644 index 000000000..ea33df398 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted19.C @@ -0,0 +1,21 @@ +// We allocate a cookie to help us run the destructor even if it's deleted. +// { dg-options -std=c++0x } +// { dg-do run } + +struct A +{ + ~A() = delete; +}; + +void *p = 0; +void *operator new[](__SIZE_TYPE__ t) +{ + p = ::operator new (t); + return p; +} + +int main() +{ + A* ap = new A[5]; + return ap == p; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted2.C b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C new file mode 100644 index 000000000..e3aac8f1a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C @@ -0,0 +1,69 @@ +// Negative test for defaulted/deleted fns. +// { dg-options "-std=c++0x" } + +void f(); // { dg-error "previous" } +void f() = delete; // { dg-error "deleted" } + +struct A +{ + A() { } // { dg-error "previous" } + void f() = default; // { dg-error "default" } +}; + +A::A() = default; // { dg-error "redefinition" } + +void g() {} // { dg-error "previous" } +void g() = delete; // { dg-error "redefinition" } + +struct B // { dg-message "user-provided default constructor" } +{ + int i; + B() = default; // { dg-message "not user-provided" } +}; + +const B b; // { dg-error "uninitialized const" } + +struct C +{ + virtual void f() = delete; // { dg-error "overriding deleted" } +}; + +struct D: public C +{ + virtual void f(); // { dg-error "non-deleted function" } +}; + +struct E +{ + const B b; + E() { } // { dg-error "uninitialized" } +}; + +struct F +{ + F() = default; + F(const F&) = delete; // { dg-error "declared" } +}; + +struct G +{ + G(); +}; + +// ctor defaulted after class defn is not trivial +G::G() = default; + +union U +{ + G g; // { dg-error "union member.*non-trivial" } +}; + +int main() +{ + F f; + F f2(f); // { dg-error "use" } + B* b = new const B; // { dg-error "uninitialized const" } + U u; // { dg-error "deleted" } +} + +// { dg-prune-output "implicitly deleted because" } diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted20.C b/gcc/testsuite/g++.dg/cpp0x/defaulted20.C new file mode 100644 index 000000000..5d536a97e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted20.C @@ -0,0 +1,20 @@ +// PR c++/46497 +// { dg-options -std=c++0x } + +struct A { + A(A&&) = default; // { dg-message "A::A|no known conversion" } +}; +struct B { + const A a; + B(const B&) = default; + B(B&&) = default; // { dg-error "implicitly deleted|no match" } + // { dg-message "candidate" "candidate note" { target *-*-* } 10 } +}; + +void g(B); // { dg-error "argument 1" } +B&& f(); + +int main() +{ + g(f()); // { dg-error "deleted" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted21.C b/gcc/testsuite/g++.dg/cpp0x/defaulted21.C new file mode 100644 index 000000000..3e740331d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted21.C @@ -0,0 +1,20 @@ +// PR c++/46736 +// { dg-options -std=c++0x } + +struct U { + U(); + U(U const&); +}; + +struct X { + U const u; + X(); + X(X&&); +}; + +X::X(X&&)=default; // { dg-error "implicitly deleted" } +// { dg-error "does not have a move constructor" "" { target *-*-* } 15 } + +X f() { + return X(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted24.C b/gcc/testsuite/g++.dg/cpp0x/defaulted24.C new file mode 100644 index 000000000..307bf94ab --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted24.C @@ -0,0 +1,6 @@ +// PR c++/48280 +// { dg-options -std=c++0x } + +struct S { + template < typename > S (const S &) = default; // { dg-error "" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted26.C b/gcc/testsuite/g++.dg/cpp0x/defaulted26.C new file mode 100644 index 000000000..69bd0accb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted26.C @@ -0,0 +1,7 @@ +// PR c++/49066 +// { dg-options -std=c++0x } + +void foo() = delete; // { dg-error "declared here" } +void foo(); + +int main() { foo(); } // { dg-error "deleted" } diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted27.C b/gcc/testsuite/g++.dg/cpp0x/defaulted27.C new file mode 100644 index 000000000..7d9139d23 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted27.C @@ -0,0 +1,19 @@ +// PR c++/47544 +// { dg-options -std=c++0x } +// { dg-final { scan-assembler "_ZN1sIiEC2Ev" } } +// { dg-final { scan-assembler-not "_ZN1sIiED2Ev" } } + +template +struct s { + s(); + ~s() = default; +}; + +extern template struct s; + +template +s::s() = default; + +template struct s; + +s a; diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted29.C b/gcc/testsuite/g++.dg/cpp0x/defaulted29.C new file mode 100644 index 000000000..5fcf5b0c5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted29.C @@ -0,0 +1,20 @@ +// PR c++/46696 +// { dg-options -std=c++0x } + +struct A +{ + A& operator= (A const&); +}; + +struct B +{ + A ar[1]; + B& operator= (B const&) = default; +}; + +int main() +{ + B x; + B y; + y = x; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted3.C b/gcc/testsuite/g++.dg/cpp0x/defaulted3.C new file mode 100644 index 000000000..5e2116b53 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted3.C @@ -0,0 +1,16 @@ +// PR c++/37006 +// { dg-options "-std=c++0x" } + +template +struct A { + template + bool operator==(const A&) = delete; // { dg-error "declared" } + operator bool () { return true; } +}; + +int main() +{ + A a1; + A a2; + if(a1 == a2) {} // { dg-error "use" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted30.C b/gcc/testsuite/g++.dg/cpp0x/defaulted30.C new file mode 100644 index 000000000..0bf4425b8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted30.C @@ -0,0 +1,16 @@ +// PR c++/49507 +// { dg-options -std=c++0x } + +template +struct ConcretePoolKey +{ + virtual ~ConcretePoolKey(); +}; + +template +ConcretePoolKey::~ConcretePoolKey() = default; + +int main() +{ + ConcretePoolKey foo; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted32.C b/gcc/testsuite/g++.dg/cpp0x/defaulted32.C new file mode 100644 index 000000000..351cdae11 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted32.C @@ -0,0 +1,21 @@ +// PR c++/50531 +// { dg-options -std=c++0x } + +template +class DataFilter +{ + public: + inline virtual ~DataFilter(); +}; + +template +inline DataFilter::~DataFilter() = default; + +class ARCalculator : public DataFilter +{ + public: + virtual void dataStart(int, int); +}; + +void ARCalculator::dataStart(int, int) +{} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted4.C b/gcc/testsuite/g++.dg/cpp0x/defaulted4.C new file mode 100644 index 000000000..56053840b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted4.C @@ -0,0 +1,26 @@ +// PR c++/37208: SFINAE and deleted functions. + +// { dg-options "-std=c++0x" } +// { dg-do compile } +template struct A { }; + +template +int& int_if_addable(A*); + +template +float& int_if_addable(...); + +struct X { }; + +struct Y { }; +Y operator+(Y, Y); + +struct Z { }; +Z operator+(Z, Z) = delete; + +void f() +{ + float& x = int_if_addable(0); + int& y = int_if_addable(0); + float& z = int_if_addable(0); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted5.C b/gcc/testsuite/g++.dg/cpp0x/defaulted5.C new file mode 100644 index 000000000..b7bd16b40 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted5.C @@ -0,0 +1,20 @@ +// PR c++/37234 +// { dg-do link } +// { dg-options "-std=c++0x" } + +template +class foo { + public: + foo() =default; + ~foo(); +}; + +template +foo::~foo() =default; + +int main() { + + foo fi; + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted6.C b/gcc/testsuite/g++.dg/cpp0x/defaulted6.C new file mode 100644 index 000000000..c33d57292 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted6.C @@ -0,0 +1,13 @@ +// PR c++/37906 +// { dg-options "-std=c++0x" } + +struct b +{ + b() = default; + b(const b&) = delete; +}; + +void test01() +{ + static_assert(__has_trivial_constructor(b), "default ctor not trivial"); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted7.C b/gcc/testsuite/g++.dg/cpp0x/defaulted7.C new file mode 100644 index 000000000..97c29258e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted7.C @@ -0,0 +1,12 @@ +// PR c++/38701, 38702 +// { dg-options "-std=c++0x" } + +void foo() = default; // { dg-error "cannot be defaulted" } +namespace +{ + void bar() = default; // { dg-error "cannot be defaulted" } +} + +enum E { e }; + +E& operator |= (E&, const E&) = default; // { dg-error "cannot be defaulted" } diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted8.C b/gcc/testsuite/g++.dg/cpp0x/defaulted8.C new file mode 100644 index 000000000..f446f8156 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted8.C @@ -0,0 +1,8 @@ +// PR c++/38649 +// { dg-options "-std=c++0x" } + +struct A +{ + A(...) = default; // { dg-error "cannot be defaulted" } + A(const A&, ...) = default; // { dg-error "cannot be defaulted" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted9.C b/gcc/testsuite/g++.dg/cpp0x/defaulted9.C new file mode 100644 index 000000000..1e5e2cbf9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted9.C @@ -0,0 +1,20 @@ +// PR c++/39153 +// { dg-options "-std=c++0x -fno-inline" } + +struct _Impl_base +{ + _Impl_base() = default; + virtual ~_Impl_base(); +}; + +inline _Impl_base::~_Impl_base() = default; + +template +class _Impl : public _Impl_base +{ }; + +int main() +{ + _Impl i; + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/dependent1.C b/gcc/testsuite/g++.dg/cpp0x/dependent1.C new file mode 100644 index 000000000..1ceeeafd7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/dependent1.C @@ -0,0 +1,25 @@ +// PR c++/48319 +// { dg-options -std=c++0x } +// We were failing to recognize declval<_Args1> as dependent. + +template Tp declval() noexcept; + +template +class __is_constructible_helper +{ + typedef char __one; + typedef struct { char __arr[2]; } __two; + + template + static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int); + + template + static __two __test(...); + +public: + static const bool __value = sizeof(__test<_Tp>(0)) == 1; +}; + +int main() { + return __is_constructible_helper::__value; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/elision.C b/gcc/testsuite/g++.dg/cpp0x/elision.C new file mode 100644 index 000000000..35d5e4b02 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/elision.C @@ -0,0 +1,76 @@ +// I, Howard Hinnant, hereby place this code in the public domain. + +// Test: Implicit cast to rvalue when eliding copy + +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template struct sa; +template <> struct sa {}; + +struct one {char x[1];}; +struct two {char x[2];}; + +class move_only +{ + move_only(const move_only&); + move_only& operator=(const move_only&); +public: + move_only() {} + move_only(move_only&&) {} + move_only& operator=(move_only&&) {return *this;} +}; + +move_only +test1() +{ + return move_only(); +} + +move_only +test2() +{ + move_only x; + return x; +} + +move_only +test3(bool b) +{ + move_only x1; + if (b) + { + move_only x2; + return x2; + } + return x1; +} + +void +test4(bool b) +{ + if (!b) + throw move_only(); +} + +void +test5(bool b) +{ + move_only x; + if (!b) + throw x; +} + +extern bool b; + +int main() +{ + move_only t1 = test1(); + move_only t2 = test2(); + move_only t3 = test3(b); + test4(b); + test5(b); + return 0; +} + +bool b = true; diff --git a/gcc/testsuite/g++.dg/cpp0x/elision2.C b/gcc/testsuite/g++.dg/cpp0x/elision2.C new file mode 100644 index 000000000..216b1b59d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/elision2.C @@ -0,0 +1,13 @@ +// Core 1148: should be able to move from value parameter on return +// { dg-options -std=c++0x } + +struct A +{ + A(const A&) = delete; + A(A&&); +}; + +A f (A a) +{ + return a; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/elision_neg.C b/gcc/testsuite/g++.dg/cpp0x/elision_neg.C new file mode 100644 index 000000000..78feac72a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/elision_neg.C @@ -0,0 +1,44 @@ +// I, Howard Hinnant, hereby place this code in the public domain. + +// Test: Implicit cast to rvalue when eliding copy + +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template struct sa; +template <> struct sa {}; + +struct one {char x[1];}; +struct two {char x[2];}; + +class move_only +{ + move_only(const move_only&); // { dg-error "is private" } + move_only& operator=(const move_only&); +public: + move_only() {} + move_only(move_only&&) {} + move_only& operator=(move_only&&) {return *this;} +}; + +move_only +test1() +{ + static move_only x; + return x; // { dg-error "within this context" } +} + +move_only +test2(move_only&& x) +{ + return x; // { dg-error "within this context" } +} + +int main() +{ + move_only t1 = test1(); + move_only t2 = test2(move_only()); + return 0; +} + +bool b = true; diff --git a/gcc/testsuite/g++.dg/cpp0x/elision_weak.C b/gcc/testsuite/g++.dg/cpp0x/elision_weak.C new file mode 100644 index 000000000..e8ba7551d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/elision_weak.C @@ -0,0 +1,19 @@ +// { dg-do compile } + +struct S +{ + S() {} + S(S&) {} +}; + +S f() +{ + S s; + return s; +} + +void g() +{ + S s; + throw s; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/enum1.C b/gcc/testsuite/g++.dg/cpp0x/enum1.C new file mode 100644 index 000000000..fb03692fa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum1.C @@ -0,0 +1,6 @@ +// PR c++/38021 +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +enum : { }; // { dg-error "expected" } +enum : 3 { }; // { dg-error "expected" } diff --git a/gcc/testsuite/g++.dg/cpp0x/enum10.C b/gcc/testsuite/g++.dg/cpp0x/enum10.C new file mode 100644 index 000000000..55a1ab46b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum10.C @@ -0,0 +1,9 @@ +// PR c++/48534 +// { dg-options -std=c++0x } + +enum class OpSE : bool; + +int main() +{ + return static_cast(OpSE()); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/enum13.C b/gcc/testsuite/g++.dg/cpp0x/enum13.C new file mode 100644 index 000000000..ec02d3bf6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum13.C @@ -0,0 +1,20 @@ +// PR c++/48780 +// { dg-options "-std=c++0x -fabi-version=5 -Wabi" } + +typedef __builtin_va_list __gnuc_va_list; +typedef __gnuc_va_list va_list; + +enum struct A : short { X }; + +void foo(int x, ...) { + va_list vl; + __builtin_va_start(vl, x); + enum A t = __builtin_va_arg(vl, enum A); // { dg-warning "promote" } + __builtin_va_end(vl); +} + +int main() { + foo(0, A::X); // { dg-warning "will not promote" } +} + +// { dg-prune-output "note" } diff --git a/gcc/testsuite/g++.dg/cpp0x/enum15.C b/gcc/testsuite/g++.dg/cpp0x/enum15.C new file mode 100644 index 000000000..d65321649 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum15.C @@ -0,0 +1,20 @@ +// PR c++/44311 +// { dg-options -std=c++0x } + +enum class A { Val0, Val1 }; + +void foo (A a, int i) +{ + switch (a) + { + case A::Val0: break; + case 1: break; // { dg-error "" } + } + + switch (i) + { + case A::Val0: break; // { dg-error "" } + case 1: break; + case 2.0: break; + } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/enum16.C b/gcc/testsuite/g++.dg/cpp0x/enum16.C new file mode 100644 index 000000000..ebb48688b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum16.C @@ -0,0 +1,6 @@ +// PR c++/48935 +// { dg-options -std=c++0x } + +enum class ENUM { a }; + +ENUM::Type func() { return ENUM::a; } // { dg-error "does not name a type" } diff --git a/gcc/testsuite/g++.dg/cpp0x/enum18.C b/gcc/testsuite/g++.dg/cpp0x/enum18.C new file mode 100644 index 000000000..5575ca6ce --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum18.C @@ -0,0 +1,8 @@ +// PR c++/47277 +// { dg-options -std=c++0x } + +int main(void) { + enum e {}; + e ev; + ev.e::~e_u(); // { dg-error "" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/enum19.C b/gcc/testsuite/g++.dg/cpp0x/enum19.C new file mode 100644 index 000000000..acdd86c0b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum19.C @@ -0,0 +1,12 @@ +// We shouldn't give an ABI warning about promotion in switch. +// { dg-options "-std=c++0x -fabi-version=5 -Wabi" } + +enum class Foo { X }; +void test(Foo val) +{ + switch(val) + { + case Foo::X: + break; + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/enum2.C b/gcc/testsuite/g++.dg/cpp0x/enum2.C new file mode 100644 index 000000000..21c265a92 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum2.C @@ -0,0 +1,5 @@ +// PR c++/38637 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template enum E : int { e }; // { dg-error "declaration|expected" } diff --git a/gcc/testsuite/g++.dg/cpp0x/enum3.C b/gcc/testsuite/g++.dg/cpp0x/enum3.C new file mode 100644 index 000000000..5ae5e1a9d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum3.C @@ -0,0 +1,27 @@ +// PR c++/38064 +// { dg-options "-std=c++0x" } +// { dg-do run } + +enum class E { elem }; + +template +void f (T t); + +bool f (bool b) { return b; } + +int main() +{ + E e = E::elem; + if (!f (e == E::elem)) + return 1; + if (!f (e <= E::elem)) + return 1; + if (!f (e >= E::elem)) + return 1; + if (f (e < E::elem)) + return 1; + if (f (e > E::elem)) + return 1; + if (f (e != E::elem)) + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/enum4.C b/gcc/testsuite/g++.dg/cpp0x/enum4.C new file mode 100644 index 000000000..002edf092 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum4.C @@ -0,0 +1,8 @@ +// PR c++/40633 +// { dg-options "-std=c++0x" } + +template< typename T > +struct wrap { + enum class E { val }; +}; + diff --git a/gcc/testsuite/g++.dg/cpp0x/enum5.C b/gcc/testsuite/g++.dg/cpp0x/enum5.C new file mode 100644 index 000000000..c4ceebed7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum5.C @@ -0,0 +1,20 @@ +// PR c++/40639 +// { dg-options "-std=c++0x" } + +template< typename T > +struct wrap { + enum E : T { val }; +}; + +template< typename T > +struct dependant { + enum E : typename T::type { val }; +}; + +template +struct identity { + typedef T type; +}; + +wrap x; +dependant> y; diff --git a/gcc/testsuite/g++.dg/cpp0x/enum6.C b/gcc/testsuite/g++.dg/cpp0x/enum6.C new file mode 100644 index 000000000..e06398471 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum6.C @@ -0,0 +1,15 @@ +// PR c++/37946 +// { dg-options "-std=c++0x" } + +enum class E : char +{ + e1, + e2 +}; + +inline E operator| (E a1, E a2) +{ + char ret = static_cast (a1) + | static_cast (a2); + return static_cast(ret); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/enum7.C b/gcc/testsuite/g++.dg/cpp0x/enum7.C new file mode 100644 index 000000000..407672a47 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum7.C @@ -0,0 +1,11 @@ +// PR c++/37816 +// { dg-options "-std=c++0x" } + +class A +{ + enum class Color { Red, Orange, Yellow, Green, Blue, Violet }; + enum class Alert { Green, Yellow, Red }; + static const Color x = Red; // { dg-error "" } + static const Color y = Color::Red; + static const Alert z = Alert::Red; +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/enum8.C b/gcc/testsuite/g++.dg/cpp0x/enum8.C new file mode 100644 index 000000000..0075e2daa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum8.C @@ -0,0 +1,10 @@ +// PR c++/47704 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +void +foo () +{ + enum class E { A, B }; + new E; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/enum9.C b/gcc/testsuite/g++.dg/cpp0x/enum9.C new file mode 100644 index 000000000..10e510bcd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum9.C @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } + +enum class E { }; +E f(); +bool b2 = static_cast(f()); diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base.C b/gcc/testsuite/g++.dg/cpp0x/enum_base.C new file mode 100644 index 000000000..5607961f2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum_base.C @@ -0,0 +1,25 @@ +// { dg-options "-std=c++0x" } + +typedef unsigned volatile long long uvlonglong; + +enum E1 : char { }; +enum E2 : signed const short { }; +enum E3 : uvlonglong { }; +enum E4 : char { + val = 500 // { dg-error "too large" } +}; + +enum class E5 { + val = (unsigned long long)-1 // { dg-error "too large" } +}; + +typedef float Float; + +enum class E6 : Float { }; // { dg-error "must be an integral type" } + +static_assert (sizeof(E1) == sizeof(char), "char-sized enum"); +static_assert (sizeof(E2) == sizeof(signed short), "short-sized enum"); +static_assert (sizeof(E3) == sizeof(unsigned long long), + "long long-sized enum"); +static_assert (sizeof(E4) == sizeof(char), "char-sized enum"); +static_assert (sizeof(E5) == sizeof(int), "scoped enum with int size"); diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base_warn.C b/gcc/testsuite/g++.dg/cpp0x/enum_base_warn.C new file mode 100644 index 000000000..4b14cf65e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum_base_warn.C @@ -0,0 +1,25 @@ +// { dg-do run } +// { dg-options "-O2 -Wtype-limits -std=c++0x" } +extern void link_error (void); + +enum Alpha : unsigned char { + ZERO = 0, ONE, TWO, THREE +}; + +Alpha a2; + +int m1 = -1; +int GetM1() { + return m1; +} + +int main() { + a2 = static_cast(GetM1()); + if (a2 == -1) { // { dg-warning "always false due" } + link_error (); + } + if (-1 == a2) { // { dg-warning "always false due" } + link_error (); + } + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/error1.C b/gcc/testsuite/g++.dg/cpp0x/error1.C new file mode 100644 index 000000000..751b3b75e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/error1.C @@ -0,0 +1,11 @@ +// PR c++/34395 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template void foo (int... x[N]) // { dg-error "int \\\[N\\\]\\.\\.\\. x" } +{ + struct A + { + A () { x; } // { dg-error "use of parameter from containing function" } + }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/error2.C b/gcc/testsuite/g++.dg/cpp0x/error2.C new file mode 100644 index 000000000..ca681eb2f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/error2.C @@ -0,0 +1,9 @@ +// PR c++/38656 +// { dg-options "-std=c++0x" } + +template int foo(); + +template void bar(F f) +{ + f((foo<0>()=0)...); // { dg-error "pattern '\\(foo\\<0\\>\\)\\(\\)=0'" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/error3.C b/gcc/testsuite/g++.dg/cpp0x/error3.C new file mode 100644 index 000000000..e7da96195 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/error3.C @@ -0,0 +1,24 @@ +// PR c++/47336 +// { dg-options -std=c++0x } + +template +void g(T t) +{ + t+1; // { dg-error "no match" } +} + +template +class C +{ + struct D {} d; +public: + decltype(g(d)) h() + { + return g(d); + } +}; + +int main() +{ + C().h(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/error4.C b/gcc/testsuite/g++.dg/cpp0x/error4.C new file mode 100644 index 000000000..29a1cddab --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/error4.C @@ -0,0 +1,22 @@ +// PR c++/49156 +// { dg-options -std=c++0x } + +template T declval(); + +template +struct S { + + template + static U get(const volatile T&); + + template + static decltype(*declval()) get(...); + + typedef decltype(get(declval())) type; // { dg-error "no match" } +}; + +struct X { }; + +S::type x; + +// { dg-prune-output "note" } diff --git a/gcc/testsuite/g++.dg/cpp0x/error6.C b/gcc/testsuite/g++.dg/cpp0x/error6.C new file mode 100644 index 000000000..35156520b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/error6.C @@ -0,0 +1,8 @@ +// PR c++/48284 +// { dg-options -std=c++0x } + +template +auto g(C& c) -> decltype (c.f()) { return c.f(); } // { dg-error "decltype .c\\.f" } + +template +auto g(C& c) -> decltype (c.f()) { return c.f(); } // { dg-error "decltype .c\\.f" } diff --git a/gcc/testsuite/g++.dg/cpp0x/explicit1.C b/gcc/testsuite/g++.dg/cpp0x/explicit1.C new file mode 100644 index 000000000..fe164fc8c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/explicit1.C @@ -0,0 +1,58 @@ +// Test for explicit conversion ops from N2437. +// { dg-options "-std=c++0x" } + +class U; class V; +class T +{ +public: + T( U const & ); + //implicit converting ctor + explicit T( V const & ); + // explicit ctor +}; +class U +{ +}; +class V +{ +}; +class W +{ +public: + operator T() const; +}; +class X +{ +public: + explicit operator T() const; // theoretical +}; +int main() +{ + U u; V v; W w; X x; + // Direct initialization: + T t1( u ); + T t2( v ); + T t3( w ); + T t4( x ); + // Copy initialization: + T t5 = u; + T t6 = v; // { dg-error "" } + T t7 = w; + T t8 = x; // { dg-error "" } + // Cast notation: + T t9 = (T) u; + T t10 = (T) v; + T t11 = (T) w; + T t12 = (T) x; + // Static cast: + T t13 = static_cast( u ); + T t14 = static_cast( v ); + T t15 = static_cast( w ); + T t16 = static_cast( x ); + // Function-style cast: + T t17 = T( u ); + T t18 = T( v ); + T t19 = T( w ); + T t20 = T( x ); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/explicit2.C b/gcc/testsuite/g++.dg/cpp0x/explicit2.C new file mode 100644 index 000000000..c2327c140 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/explicit2.C @@ -0,0 +1,29 @@ +// Test for explicit conversion ops in various conversion situations. +// { dg-options "-std=c++0x" } + +typedef void (*pfn)(); + +struct A +{ + explicit operator int() const; + explicit operator pfn() const; +}; + +int main() +{ + A a; + int i = a; // { dg-error "" } + const int &ir = a; // { dg-error "" } + a(); // { dg-error "" } + a + 1; // { dg-message "" } (error and note on same line) + + int j (a); + (int)a; + static_cast(a); +} + +struct B +{ + int i; + B(const A& a): i(a) { } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/explicit3.C b/gcc/testsuite/g++.dg/cpp0x/explicit3.C new file mode 100644 index 000000000..be0a14e7a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/explicit3.C @@ -0,0 +1,51 @@ +// Test for "contextually converted to bool" +// { dg-options "-std=c++0x" } + +struct A +{ + explicit operator bool(); +}; + +void f (bool); + +struct B +{ + bool b; +}; + +struct C +{ + operator int(); +}; + +struct D +{ + operator int(); +}; + +int main() +{ + A a; C c; D d; + // These contexts use an explicit bool conversion. + if (a) {} + for (; a; ) {} + do {} while (a); + while (a) {} + a ? 1 : 0; + a || true; + a && true; + !a; + + a ? c : 1; + a ? c : d; + + // These do not. + switch (a); // { dg-error "" } + bool b = a; // { dg-error "" } + // { dg-message "candidate" "candidate note" { target *-*-* } 44 } + f(a); // { dg-error "" } + B b2 = { a }; // { dg-error "" } + a + true; // { dg-message "" } + b ? a : true; // { dg-message "" } + a ? a : true; // { dg-message "" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/explicit4.C b/gcc/testsuite/g++.dg/cpp0x/explicit4.C new file mode 100644 index 000000000..0f3bc623a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/explicit4.C @@ -0,0 +1,18 @@ +// Negative explicit conv test. +// { dg-options "-std=c++0x" } + +struct A { + A(const A&, int = 0); // { dg-message "note" } +}; +struct B +{ + explicit operator A(); +}; + +int main() +{ + B b; + (A(b)); // OK + (A(b,1)); // { dg-error "no match" } + // { dg-message "candidate" "candidate note" { target *-*-* } 16 } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/explicit5.C b/gcc/testsuite/g++.dg/cpp0x/explicit5.C new file mode 100644 index 000000000..88a47071d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/explicit5.C @@ -0,0 +1,25 @@ +// test for extension of DR 899 to handle template ctors +// { dg-options "-std=c++0x" } +// { dg-do run } + +int r = 1; + +struct C { + C() { } + template C(C&, T = 0) { r = 0; } +}; + +C c; + +struct A +{ + explicit operator C&() const { return c; } +}; + +int main() +{ + A a; + C c2 (a); + + return r; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-1.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-1.C new file mode 100644 index 000000000..ec2cb784e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-1.C @@ -0,0 +1,4 @@ +// { dg-options "-std=c++0x -pedantic" } + +template void f() {} +extern template void f(); diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-2.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-2.C new file mode 100644 index 000000000..89a9ceb5a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-2.C @@ -0,0 +1,4 @@ +// { dg-options "-std=c++0x -pedantic" } + +template class S {}; +extern template class S; diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-3.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-3.C new file mode 100644 index 000000000..1b7ad0e01 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-3.C @@ -0,0 +1,16 @@ +// PR c++/37256 +// { dg-options "-O" } + +template +struct B +{ + T_ f(); +}; + +extern template class B; + +void f() +{ + B t; + t.f(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C new file mode 100644 index 000000000..25192ad86 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C @@ -0,0 +1,7 @@ +// PR c++/37766 +// { dg-options -std=c++0x } + +int a = 1; +template void f() { + f<>(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg2.C b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg2.C new file mode 100644 index 000000000..12cc83659 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg2.C @@ -0,0 +1,14 @@ +// PR c++/46831 +// { dg-options -std=c++0x } + +struct B { }; +struct D : B { }; +struct A { + template operator D&(); + operator long(); +}; + +void f(long); +void f(B&); + +int main() { f(A()); } diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum1.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum1.C new file mode 100644 index 000000000..2817ae595 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum1.C @@ -0,0 +1,45 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// opaque enum declarations +enum class E1; +enum class E2 : int; +enum class E3 : short; +enum E4 : int; +enum E5 : short; + +// can be repeated +enum class E1; +enum class E2 : int; +enum class E3 : short; +enum E4 : int; +enum E5 : short; + +// are complete so we can declare variables +E1 b1; +E2 b2; +E3 b3; +E4 b4; +E5 b5; + +//even with elaborated-type-specifiers +enum E1 a1; +enum E2 a2; +enum E3 a3; +enum E4 a4; +enum E5 a5; + +// and the list can be added later +enum class E1 { e11, e12 }; +enum class E2 : int { e21, e22 }; +enum class E3 : short {e31, e32 }; +enum E4 : int { e41, e42 }; +enum E5 : short { e51, e52 }; + +// more repetitions allowed +enum class E1; +enum class E2 : int; +enum class E3 : short; +enum E4 : int; +enum E5 : short; + diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum2.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum2.C new file mode 100644 index 000000000..b6ad87148 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum2.C @@ -0,0 +1,44 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +struct S1 +{ + struct S2 + { + // opaque enum declarations + enum class E1; + enum class E2 : int; + enum class E3 : short; + enum E4 : int; + enum E5 : short; + + // can be repeated + enum class E1; + enum class E2 : int; + enum class E3 : short; + enum E4 : int; + enum E5 : short; + }; +}; + +// are complete so we can declare variables +S1::S2::E1 b1; +S1::S2::E2 b2; +S1::S2::E3 b3; +S1::S2::E4 b4; +S1::S2::E5 b5; + +//even with elaborated-type-specifiers +enum S1::S2::E1 a1; +enum S1::S2::E2 a2; +enum S1::S2::E3 a3; +enum S1::S2::E4 a4; +enum S1::S2::E5 a5; + +// and the list can be added later +enum class S1::S2::E1 { e11, e12 }; +enum class S1::S2::E2 : int { e21, e22 }; +enum class S1::S2::E3 : short {e31, e32 }; +enum S1::S2::E4 : int { e41, e42 }; +enum S1::S2::E5 : short { e51, e52 }; + diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum3.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum3.C new file mode 100644 index 000000000..4a7e9f98d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum3.C @@ -0,0 +1,44 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +namespace S1 +{ + namespace S2 + { + // opaque enum declarations + enum class E1; + enum class E2 : int; + enum class E3 : short; + enum E4 : int; + enum E5 : short; + + // can be repeated + enum class E1; + enum class E2 : int; + enum class E3 : short; + enum E4 : int; + enum E5 : short; + } +} + +// are complete so we can declare variables +S1::S2::E1 b1; +S1::S2::E2 b2; +S1::S2::E3 b3; +S1::S2::E4 b4; +S1::S2::E5 b5; + +//even with elaborated-type-specifiers +enum S1::S2::E1 a1; +enum S1::S2::E2 a2; +enum S1::S2::E3 a3; +enum S1::S2::E4 a4; +enum S1::S2::E5 a5; + +// and the list can be added later +enum class S1::S2::E1 { e11, e12 }; +enum class S1::S2::E2 : int { e21, e22 }; +enum class S1::S2::E3 : short {e31, e32 }; +enum S1::S2::E4 : int { e41, e42 }; +enum S1::S2::E5 : short { e51, e52 }; + diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum4.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum4.C new file mode 100644 index 000000000..0fcc3bde0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum4.C @@ -0,0 +1,45 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template struct S1 +{ + struct S2 + { + // opaque enum declarations + enum class E1; + enum class E2 : T; + enum class E3 : short; + enum E4 : T; + enum E5 : short; + + // can be repeated + enum class E1; + enum class E2 : T; + enum class E3 : short; + enum E4 : T; + enum E5 : short; + }; + + // are complete so we can declare variables + typename S2::E1 b1; + typename S2::E2 b2; + typename S2::E3 b3; + typename S2::E4 b4; + typename S2::E5 b5; + + //even with elaborated-type-specifiers + enum S1::S2::E1 a1; + enum S1::S2::E2 a2; + enum S1::S2::E3 a3; + enum S1::S2::E4 a4; + enum S1::S2::E5 a5; + + // and the list can be added later + enum class S1::S2::E1 { e11, e12 }; + enum class S1::S2::E2 : T { e21, e22 }; + enum class S1::S2::E3 : short {e31, e32 }; + enum S1::S2::E4 : T { e41, e42 }; + enum S1::S2::E5 : short { e51, e52 }; +}; + +template struct S1; diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum5.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum5.C new file mode 100644 index 000000000..a2edfa763 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum5.C @@ -0,0 +1,63 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +namespace one +{ + struct S + { + enum { A = 1, B = 2 }; + struct T + { + enum { B = 102 }; + + enum class E1; + enum E2 : int; + }; + }; + + enum class S::T::E1 { A1 = A, B1 = B, C1 }; + enum S::T::E2 : int { A1 = A, B1 = B, C1 }; + + static_assert(int(S::T::E1::A1) == 1, "error"); + static_assert(int(S::T::E1::B1) == 102, "error"); + static_assert(int(S::T::E1::C1) == 103, "error"); + + static_assert(int(S::T::E2::A1) == 1, "error"); + static_assert(int(S::T::E2::B1) == 102, "error"); + static_assert(int(S::T::E2::C1) == 103, "error"); + static_assert(int(S::T::A1) == 1, "error"); + static_assert(int(S::T::B1) == 102, "error"); + static_assert(int(S::T::C1) == 103, "error"); +} + + +namespace two +{ + namespace S + { + enum { A = 1, B = 2 }; + namespace T + { + enum { B = 102 }; + + enum class E1; + enum E2 : int; + } + } + + enum class S::T::E1 { A1 = A, B1 = B, C1 }; + enum S::T::E2 : int { A1 = A, B1 = B, C1 }; + + static_assert(int(S::T::E1::A1) == 1, "error"); + static_assert(int(S::T::E1::B1) == 102, "error"); + static_assert(int(S::T::E1::C1) == 103, "error"); + + static_assert(int(S::T::E2::A1) == 1, "error"); + static_assert(int(S::T::E2::B1) == 102, "error"); + static_assert(int(S::T::E2::C1) == 103, "error"); + static_assert(int(S::T::A1) == 1, "error"); + static_assert(int(S::T::B1) == 102, "error"); + static_assert(int(S::T::C1) == 103, "error"); +} + + diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C new file mode 100644 index 000000000..51ef6e43e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C @@ -0,0 +1,74 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +enum class E1 : int; // { dg-error "previous definition" } +enum E1 : int; // { dg-error "scoped/unscoped mismatch" } + +enum E2 : int; // { dg-error "previous definition" } +enum class E2 : int; // { dg-error "scoped/unscoped mismatch" } + +enum struct E3 : int; +enum class E3 : int; //ok + +enum class E4 : int; // { dg-error "previous definition" } +enum class E4 : long; // { dg-error "different underlying type" } + +enum E5 : int; // { dg-error "previous definition" } +enum E5 : long; // { dg-error "different underlying type" } + +enum E6 : int; +enum E6 : int; //ok + +enum class E7; +enum class E7 : int; //ok + +enum class E3 e3; // { dg-warning "scoped enum must not use" } +enum struct E3 e4; // { dg-warning "scoped enum must not use" } +enum E5 : int e5; // { dg-error "expected|invalid type" } + +enum E6 : int { a, b, c }; // { dg-error "previous definition" } +enum E6 : int { a, b, c }; // { dg-error "multiple definition" } + +enum class E7 { }; // { dg-error "previous definition" } +enum class E7 { a, b, c }; // { dg-error "multiple definition" } + +namespace N1 +{ + struct D; + enum class E6; + enum E7 : int; +} + +enum class N1::E6; // { dg-error "must use a simple identifier" } +enum N1::E6 e6_1; //ok +enum ::N1::E6 e6_2; //ok + +namespace N2 +{ + enum class N1::E6 { e1, e2, e3 }; // { dg-error "does not enclose" } + enum N1::E7 : int { e1, e2, e3 }; // { dg-error "does not enclose" } +}; + +enum class N1::E6 { e1, e2, e3 }; +enum N1::E7 : int { e1, e2, e3 }; + +struct S1 +{ + struct D; + enum class E6; + enum E7 : int; +}; + +enum class S1::E6; // { dg-error "must use a simple identifier" } +enum S1::E6 e6_3; //ok +enum ::S1::E6 e6_4; //ok + +struct S2 +{ + enum class S1::E6 { e1, e2, e3 }; // { dg-error "does not enclose" } + enum S1::E7 : int { e1, e2, e3 }; // { dg-error "does not enclose" } +}; + +enum class S1::E6 { e1, e2, e3 }; +enum S1::E7 : int { e1, e2, e3 }; + diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum7.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum7.C new file mode 100644 index 000000000..62e445c70 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum7.C @@ -0,0 +1,21 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template struct S1 +{ + enum E1 : int; + enum E1 : T; + enum class E2 : int; + enum class E2 : T; +}; + +template enum S1::E1 : int { e1 }; +template enum class S1::E2 : T { e2 }; + +S1::E1 x1 = S1::e1; +S1::E1 x11 = S1::E1::e1; +S1::E2 x2 = S1::E2::e2; + +enum S1::E1 ex1 = S1::e1; +enum S1::E1 ex11 = S1::E1::e1; +enum S1::E2 ex2 = S1::E2::e2; diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum8.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum8.C new file mode 100644 index 000000000..c87aa5bf6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum8.C @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +//This instatiation is ok +template struct S1 +{ + enum E : int; + enum E : T; +}; +template struct S1; //ok + +//This error is diagnosed at instantiation time +template struct S2 +{ + enum E : int; // { dg-error "previous definition" } + enum E : T; // { dg-error "different underlying type" } +}; +template struct S2; // { dg-message "instantiated from here" } + +//This error is diagnosed at compilation time +template struct S3 +{ + enum E : int; // { dg-error "previous definition" } + enum E : short; // { dg-error "different underlying type" } +}; + diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C new file mode 100644 index 000000000..da8cde27b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C @@ -0,0 +1,21 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template struct S1 +{ + enum E1 : int; + enum class E2 : int; +}; + +template enum S1::E1 : int { e1 }; +template enum class S1::E2 : T { e2 }; + +template<> enum S1::E1 : int { i1 }; +template<> enum class S1::E2 : int { i2 }; + +S1::E1 xci = S1::e1; +S1::E1 xi1 = S1::i1; + +S1::E2 xc2 = S1::E2::e2; +S1::E2 xi2 = S1::E2::i2; + diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit-copy.C b/gcc/testsuite/g++.dg/cpp0x/implicit-copy.C new file mode 100644 index 000000000..861fe201f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit-copy.C @@ -0,0 +1,15 @@ +// { dg-options "--std=c++0x" } +struct S +{ + S(); +private: + S(S const &&); // { dg-error "" } + S & operator=(S const &&); // { dg-error "" } +}; + +void f() +{ + S a; + S b(a); // { dg-error "" } + a = b; // { dg-error "" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit-trivial1.C b/gcc/testsuite/g++.dg/cpp0x/implicit-trivial1.C new file mode 100644 index 000000000..64084c148 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit-trivial1.C @@ -0,0 +1,23 @@ +// PR c++/46807 +// { dg-options -std=c++0x } +// In C++98/03, B::B(const B&) is trivial because A::A(const A&) is trivial, +// even though doing overload resolution would mean calling the template +// constructor. In C++0x, we do overload resolution to determine triviality. + +struct A +{ + A() {} +private: + template A(T&); // { dg-error "private" } +}; + +struct B // { dg-error "implicitly deleted|this context" } +{ + mutable A a; +}; + +int main() +{ + B b; + B b2(b); // { dg-error "deleted" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit1.C b/gcc/testsuite/g++.dg/cpp0x/implicit1.C new file mode 100644 index 000000000..2efbde6a9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit1.C @@ -0,0 +1,26 @@ +// Test for implicitly deleted destructors. +// { dg-options "-std=c++0x" } +// { dg-prune-output "default definition would be ill-formed" } +// { dg-prune-output "within this context" } + +class C +{ + void operator delete (void *); // { dg-error "private" } +public: + virtual ~C(); // { dg-error "overriding" } +}; + +struct D: C { }; // { dg-error "deleted" } +D d; // { dg-error "deleted" } + +struct E +{ + ~E() = delete; // { dg-error "declared here" } +}; + +struct F +{ + virtual ~F(); // { dg-error "overriding" } +}; + +struct G: E, F { }; // { dg-error "deleted" } diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit10.C b/gcc/testsuite/g++.dg/cpp0x/implicit10.C new file mode 100644 index 000000000..721a93dd5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit10.C @@ -0,0 +1,19 @@ +// PR c++/46103 +// { dg-options -std=c++0x } + +struct MoveOnly { + MoveOnly(const MoveOnly&) = delete; + MoveOnly(MoveOnly&&) { } + MoveOnly() = default; +}; + +struct A { + MoveOnly mo[1]; + A() = default; + A(A&&) = default; +}; + +int main() { + A a; + A aa = static_cast(a); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit2.C b/gcc/testsuite/g++.dg/cpp0x/implicit2.C new file mode 100644 index 000000000..f24a78838 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit2.C @@ -0,0 +1,33 @@ +// Test that the synthesized C copy constructor calls the A template +// constructor and has the appropriate exception specification. +// { dg-options -std=c++0x } +// { dg-do run } + +int r = 1; + +struct A +{ + A() {} + A(const A&) throw () { } + template + A(T& t) { r = 0; } +}; + +struct B +{ + B() {} + B(B&) throw () { } +}; + +struct C: A, B { }; + +#define SA(E) static_assert(E, #E) + +C c; +SA (!noexcept(C(c))); + +int main() +{ + (C(c)); + return r; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit3.C b/gcc/testsuite/g++.dg/cpp0x/implicit3.C new file mode 100644 index 000000000..a43eca708 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit3.C @@ -0,0 +1,56 @@ +// Basic runtime test for implicit move constructor +// { dg-do run } +// { dg-options -std=c++0x } + +int m; + +struct A +{ + A() = default; + A(A&&) { ++m; } + A& operator=(A&&) { ++m; return *this; } +}; + +struct B +{ + B() = default; + B(const B&); + B(B&&) { ++m; } + B& operator=(const B&); + B& operator=(B&&) { ++m; return *this; } +}; + +struct C +{ + C() = default; + C(C&); + C(C&&) { ++m; } + C& operator=(C&); + C& operator=(C&&) { ++m; return *this; } +}; + +struct D: public A, public B +{ + C c; + int i; +}; + +struct E: public A, public B +{ + C c; + int i; + E() = default; + E(E&&) = default; + E& operator=(E&&) = default; +}; + +int main() +{ + D d1; + D d2 (static_cast(d1)); + d1 = static_cast(d2); + E e1; + E e2 (static_cast(e1)); + e1 = static_cast(e2); + return m != 12; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit4.C b/gcc/testsuite/g++.dg/cpp0x/implicit4.C new file mode 100644 index 000000000..f97eb7549 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit4.C @@ -0,0 +1,21 @@ +// Test that a base with only a move constructor causes the implicit copy +// constructor to be deleted. +// { dg-options "-std=c++0x" } + +struct A +{ + A(); // { dg-message "A::A|candidate expects" } + A(A&&); // { dg-message "A::A|no known conversion" } +}; + +struct B: A // { dg-error "implicit|no match" } +// { dg-message "candidate" "candidate note" { target *-*-* } 11 } +{ +}; + +int main() +{ + B b1; + B b2(b1); // { dg-error "deleted function .B::B.const" } + B b3(static_cast(b1)); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit5.C b/gcc/testsuite/g++.dg/cpp0x/implicit5.C new file mode 100644 index 000000000..f25c08530 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit5.C @@ -0,0 +1,19 @@ +// Test that the default B copy constructor calls the A member template +// constructor. +// { dg-options -std=c++0x } + +struct A +{ + A() = default; + A(A&&) = default; + template + A(const T& t) { t.i; } // { dg-error "no member" } +}; + +struct B: A { }; + +int main() +{ + B b; + B b2(b); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit6.C b/gcc/testsuite/g++.dg/cpp0x/implicit6.C new file mode 100644 index 000000000..c7902969d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit6.C @@ -0,0 +1,23 @@ +// Circular implicit declarations were causing errors +// { dg-options -std=c++0x } + +struct Ray; + +struct Vector +{ + virtual void f(); // make non-trivially-copyable + Vector(const Ray &) ; +}; + +struct array +{ + Vector v; +}; + +struct Ray +{ + array a; +}; + +extern Ray r1; +Ray r2=r1; diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit7.C b/gcc/testsuite/g++.dg/cpp0x/implicit7.C new file mode 100644 index 000000000..f29e5009f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit7.C @@ -0,0 +1,37 @@ +// PR c++/44909 +// { dg-options -std=c++0x } +// Declaring A>'s copy ctor means choosing a ctor to initialize D, +// which means choosing a ctor for C>, which meant considering +// C(const B&) which means choosing a ctor for B, which means choosing +// a ctor for A>. Cycle. + +template +struct A +{ + T t; +}; + +template +struct B +{ + typename T::U u; +}; + +template +struct C +{ + C(const T&); +}; + +template +struct D +{ + C > v; +}; + +struct E { + typedef A > U; +}; + +extern A > a; +A > a2(a); diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit8.C b/gcc/testsuite/g++.dg/cpp0x/implicit8.C new file mode 100644 index 000000000..2f3febae8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit8.C @@ -0,0 +1,34 @@ +// The hack for PR c++/44909 breaks this testcase. We need feedback +// from the C++ committee to know how to proceed. +// { dg-options -std=c++0x } +// { dg-prune-output "implicitly deleted" } +// { dg-prune-output "cannot bind" } +// { dg-prune-output "initializing argument" } + +struct A +{ + A(); + A(A&); +}; + +struct B; +struct BP +{ + BP(const B&); +}; + +struct B +{ + B(); + B(B&&); + B(const BP&); +}; + +// If B(B&&) suppresses the B copy constructor, then copying the B +// subobject of C should use B(const BP&). But we ignore that constructor +// in order to break the cycle in 44909. Perhaps the move ctor shouldn't +// suppress the copy ctor? +struct C: A, B { }; + +C c; +C c2(c); // { dg-bogus "deleted" "" { xfail *-*-* } } diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit9.C b/gcc/testsuite/g++.dg/cpp0x/implicit9.C new file mode 100644 index 000000000..3a6dbc558 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit9.C @@ -0,0 +1,12 @@ +// Test that private base dtor makes derived ctor deleted +// { dg-options -std=c++0x } + +struct A +{ + A(); +private: + ~A(); // { dg-error "private" } +}; + +struct B: A { }; // { dg-error "implicitly deleted|context" } +B * b = new B; // { dg-error "deleted" } diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-49216.C b/gcc/testsuite/g++.dg/cpp0x/initlist-49216.C new file mode 100644 index 000000000..4bf608229 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-49216.C @@ -0,0 +1,6 @@ +// PR c++/49216 +// { dg-options -std=c++0x } + +int main() { + new int[1]{}; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-array2.C b/gcc/testsuite/g++.dg/cpp0x/initlist-array2.C new file mode 100644 index 000000000..19eec33ac --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-array2.C @@ -0,0 +1,12 @@ +// { dg-options -std=c++0x } + +typedef int IA[2]; +typedef double DA[2]; + +void f(const IA&) { } +void f(const DA&); + +int main() +{ + f({1,2}); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C b/gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C new file mode 100644 index 000000000..25113d770 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } + +typedef int IRT[2]; + +const IRT& ir = IRT{1,2}; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C b/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C new file mode 100644 index 000000000..e422132af --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C @@ -0,0 +1,26 @@ +// Test for deduction of T as std::initializer_list. This isn't currently +// supported by the working draft, but is necessary for perfect forwarding +// of initializer-lists to things that can take a std::initializer_list. + +// { dg-options -std=c++0x } +// { dg-do run } + +#include + +struct A +{ + A(std::initializer_list) { } +}; + +void f (A a) { } + +template +auto g (T&& t) -> decltype (f(t)) // { dg-warning "call" } +{ + return f(t); +} + +int main() +{ + g({1}); // { dg-warning "deduc" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-opt.C b/gcc/testsuite/g++.dg/cpp0x/initlist-opt.C new file mode 100644 index 000000000..d17cda3f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-opt.C @@ -0,0 +1,19 @@ +// PR c++/41997 +// { dg-options "-std=c++0x -O2 -fdump-tree-optimized" } +// { dg-final { scan-tree-dump-not "_0" "optimized" } } +// { dg-final { cleanup-tree-dump "optimized" } } + +#include + +inline int max_val(std::initializer_list il) +{ + int i = *(il.begin()); + int j = *(il.begin() + 1); + return (i > j ? i : j); +} + +int main(void) +{ + return max_val({1,2}); +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist1.C b/gcc/testsuite/g++.dg/cpp0x/initlist1.C new file mode 100644 index 000000000..ff45f7176 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist1.C @@ -0,0 +1,72 @@ +// Basic uses of initializer lists +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include + +extern "C" void abort(); + +using namespace std; + +struct A { int i,j; A(int _i,int _j): i(_i), j(_j) {} }; +struct B { A a; B(A _a): a(_a) {} }; +struct C { B b; C(B _b): b(_b) {} }; + +struct D +{ + int ia[3]; + D (initializer_list l) + { + const int *p = l.begin(); + for (int i = 0; i < 3; ++i) + ia[i] = *p++; + } +}; + +void f(C c) +{ + if (c.b.a.i != 1) abort(); + if (c.b.a.j != 2) abort(); +} +void f(int); + +void g(D d) +{ + if (d.ia[0] != 1 || d.ia[1] != 2 || d.ia[2] != 3) + abort(); +} + +struct E +{ + int i, j, k; +}; + +void h(E e) +{ + if (e.i != 1 || e.j != 2 || e.k != 3) + abort(); +} + +void i(initializer_list l) +{ + const int *p = l.begin(); + if (*p++ != 1) abort(); + if (*p++ != 2) abort(); + if (*p++ != 3) abort(); + if (p != l.end()) abort(); +} + +struct U { U(int, int) {} }; +U ua[] = { { 3, 2 } }; + +int main() +{ + g({1,2,3}); + + h({1,2,3}); + + f({{{1,2}}}); + f({{A{1,2}}}); + + i({1,2,3}); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist10.C b/gcc/testsuite/g++.dg/cpp0x/initlist10.C new file mode 100644 index 000000000..bf955f513 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist10.C @@ -0,0 +1,53 @@ +// PR c++/38380 +// { dg-options "-std=gnu++0x" } + +namespace std +{ + struct atomic_bool + { + bool _M_i; + + atomic_bool() = default; + ~atomic_bool() = default; + atomic_bool(const atomic_bool&) = delete; + atomic_bool& operator=(const atomic_bool&) = delete; + + explicit atomic_bool(bool __i) { _M_i = __i; } + + operator bool() const volatile + { return true; } + }; +} + +namespace __gnu_test +{ + struct direct_list_initializable + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + _Ttype __v1 = { }; // default ctor + _Ttype __v2 { __a }; // single-argument ctor + } + + _Tvalue __a; + }; + + void (_Concept::*__x)() __attribute__((unused)) + = &_Concept::__constraint; + } + }; +} + +int main() +{ + __gnu_test::direct_list_initializable test; + + test.operator()(); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist11.C b/gcc/testsuite/g++.dg/cpp0x/initlist11.C new file mode 100644 index 000000000..546a5335f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist11.C @@ -0,0 +1,18 @@ +// PR c++/38684 +// { dg-options "-std=c++0x" } + +#include + +struct Y {}; + +struct X : Y { + X(std::initializer_list) {} +}; + +struct A { + X v; +}; + +int main() { + A a{ {1,2,3} }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist12.C b/gcc/testsuite/g++.dg/cpp0x/initlist12.C new file mode 100644 index 000000000..f344c780c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist12.C @@ -0,0 +1,21 @@ +// PR c++/38698 +// { dg-options "-std=c++0x" } +// { dg-prune-output "note" } + +struct A +{ + int i; +}; + +A a({1,2}); // { dg-error "no match" } + +union U +{ + int i,j; +}; + +U u({1,2}); // { dg-error "no match" } + +union V {}; + +V v({1}); // { dg-error "no match" } diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist13.C b/gcc/testsuite/g++.dg/cpp0x/initlist13.C new file mode 100644 index 000000000..9ed6c7441 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist13.C @@ -0,0 +1,8 @@ +// PR c++/39056 +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +#include + +__complex__ int i ({0}); +std::complex i2 ({0}); diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist14.C b/gcc/testsuite/g++.dg/cpp0x/initlist14.C new file mode 100644 index 000000000..bb67f3e54 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist14.C @@ -0,0 +1,19 @@ +// Bug: We weren't doing the normal replacement of array with pointer +// for deduction in the context of a call because of the initializer list. +// { dg-options "-std=c++0x" } + +#include + +struct string +{ + string (const char *); +}; + +template +struct vector +{ + template + vector (std::initializer_list); +}; + +vector v = { "a", "b", "c" }; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist15.C b/gcc/testsuite/g++.dg/cpp0x/initlist15.C new file mode 100644 index 000000000..b75cc8172 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist15.C @@ -0,0 +1,20 @@ +// { dg-options "-std=c++0x" } + +// Just discard errors pointing at header files +// { dg-prune-output "include" } + +#include +#include + +using namespace std; + +template< typename ... ArgTypes > +void test( ArgTypes ... args ) { + vector x = { &typeid(ArgTypes)... }; // { dg-error "" } +} + +int main() +{ + test( 1, 3.14f, 2.78 ); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist16.C b/gcc/testsuite/g++.dg/cpp0x/initlist16.C new file mode 100644 index 000000000..86a003960 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist16.C @@ -0,0 +1,12 @@ +// { dg-options "-std=c++0x" } +// { dg-do run } + +extern "C" void abort(); + +void f(int i) { if (i != 42) abort(); } + +int main() +{ + f({42}); + return {0}; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist17.C b/gcc/testsuite/g++.dg/cpp0x/initlist17.C new file mode 100644 index 000000000..86371e819 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist17.C @@ -0,0 +1,9 @@ +// { dg-options "-std=c++0x" } + +void f(int i); + +int main() +{ + f({42.0}); // { dg-error "narrowing" } + return {1.0}; // { dg-error "narrowing" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist18.C b/gcc/testsuite/g++.dg/cpp0x/initlist18.C new file mode 100644 index 000000000..c9a9bcd94 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist18.C @@ -0,0 +1,19 @@ +// PR c++/40308, 40311 +// { dg-do run } +// { dg-options "-std=c++0x" } + +template< typename T > +struct test { + test() : data{} {} + + T data; +}; + +int main() +{ + test x; + test y; + int * a = new int{}; + int * b = new int{5}; + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist19.C b/gcc/testsuite/g++.dg/cpp0x/initlist19.C new file mode 100644 index 000000000..9cb197c9b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist19.C @@ -0,0 +1,10 @@ +// { dg-options "-std=c++0x" } + +// Allow other errors, too +// { dg-prune-output "error" } + +void f(double); +int main() +{ + f({{1}}); // { dg-error "too many braces" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist2.C b/gcc/testsuite/g++.dg/cpp0x/initlist2.C new file mode 100644 index 000000000..2fe477056 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist2.C @@ -0,0 +1,32 @@ +// Test that conversion to std::initializer_list takes priority over other +// user-defined conversions. + +// { dg-do link } +// { dg-options "-std=c++0x" } + +#include + +struct string +{ + string (const char *) {} + template string (Iter, Iter); +}; + +template +struct pair +{ + pair (T t, U u) {} +}; + +template +struct map +{ + void insert (pair); + void insert (std::initializer_list >) {} +}; + +int main() +{ + map m; + m.insert({ {"this","that"}, {"me","you"} }); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist20.C b/gcc/testsuite/g++.dg/cpp0x/initlist20.C new file mode 100644 index 000000000..fcdb73f19 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist20.C @@ -0,0 +1,17 @@ +// PR c++/40689 +// { dg-options "-std=c++0x" } + +class X +{ + public: + X(): data {1,2,3,4,5} {} + private: + const short data[5]; +}; + +int main() +{ + const float * pData = new const float[4] { 1.5, 2.5, 3.5, 4.5 }; + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist21.C b/gcc/testsuite/g++.dg/cpp0x/initlist21.C new file mode 100644 index 000000000..9412a0851 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist21.C @@ -0,0 +1,18 @@ +// PR c++/40689 +// { dg-options "-std=c++0x" } + +class X +{ + public: + X(): data {1,2} {} // { dg-error "too many initializers" } + private: + const short data[1]; +}; + +int f(int n) +{ + const float * pData = new const float[1] { 1.5, 2.5 }; // { dg-error "too many initializers" } + pData = new const float[n] { 1.5, 2.5 }; // { dg-warning "array size" } + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist22.C b/gcc/testsuite/g++.dg/cpp0x/initlist22.C new file mode 100644 index 000000000..0855b59d5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist22.C @@ -0,0 +1,24 @@ +// Core issue 934 +// { dg-options "-std=c++0x" } + +int i; + +int& r1{ i }; // OK, direct binding +int&& r2{ i }; // { dg-error "" } binding && to lvalue + +int& r3{ }; // { dg-error "" } reference to temporary +int&& r4{ }; // OK, reference to temporary + +struct A { int i; } a; + +A& r5 { i }; // { dg-error "" } reference to temporary +A&& r6 { i }; // OK, aggregate initialization of temporary +A& r7 { a }; // { dg-error "" } invalid aggregate initializer for A +A&& r8 { a }; // { dg-error "" } invalid aggregate initializer for A + +struct B { B(int); int i; } b(0); + +B& r9 { i }; // { dg-error "" } reference to temporary +B&& r10 { i }; // OK, make temporary with B(int) constructor +B& r11 { b }; // { dg-error "" } reference to temporary +B&& r12 { b }; // OK, make temporary with copy constructor diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist23.C b/gcc/testsuite/g++.dg/cpp0x/initlist23.C new file mode 100644 index 000000000..48a997fca --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist23.C @@ -0,0 +1,15 @@ +// { dg-options "-std=c++0x" } + +#include + +struct A +{ + A& operator=(int i); + A& operator=(std::initializer_list l) { return *this; } +}; + +int main() +{ + A a; + a = { }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist24.C b/gcc/testsuite/g++.dg/cpp0x/initlist24.C new file mode 100644 index 000000000..33e97c7df --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist24.C @@ -0,0 +1,9 @@ +// PR c++/39923 +// { dg-options "-std=c++0x" } + +#include + +void test3() +{ + std::initializer_list list{move}; // { dg-error "not declared|could not convert" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist25.C b/gcc/testsuite/g++.dg/cpp0x/initlist25.C new file mode 100644 index 000000000..8e5e0065c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist25.C @@ -0,0 +1,17 @@ +// PR c++/41754 +// { dg-options -std=c++0x } +// { dg-do run } + +#include +#include +#include + +using namespace std; + +int main() +{ + map m; + m.insert({{"t", "t"}, {"y", "y"}}); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist26.C b/gcc/testsuite/g++.dg/cpp0x/initlist26.C new file mode 100644 index 000000000..bb28bdbd9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist26.C @@ -0,0 +1,10 @@ +// PR c++/42059 +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +void +foo (int i) +{ + int a[i]; + a = { }; // { dg-error "assign" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist27.C b/gcc/testsuite/g++.dg/cpp0x/initlist27.C new file mode 100644 index 000000000..f8536d3e7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist27.C @@ -0,0 +1,5 @@ +// PR c++/42061 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +int& i = { j }; // { dg-error "invalid initialization|was not declared" } diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist28.C b/gcc/testsuite/g++.dg/cpp0x/initlist28.C new file mode 100644 index 000000000..d1df7cb00 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist28.C @@ -0,0 +1,8 @@ +// PR c++/42060 +// { dg-options "-std=c++0x" } + +void foo() +{ + int a[1]; + throw a = {}; // { dg-error "assign" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist29.C b/gcc/testsuite/g++.dg/cpp0x/initlist29.C new file mode 100644 index 000000000..1568678e0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist29.C @@ -0,0 +1,14 @@ +// PR c++/42331 +// { dg-options "-std=c++0x" } + +class Mesh +{ +public: + Mesh(const char*) + { typele={0}; } // { dg-error "" } + +private: + int typele[7][2]; +}; + +Mesh m(0); diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist3.C b/gcc/testsuite/g++.dg/cpp0x/initlist3.C new file mode 100644 index 000000000..412deb511 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist3.C @@ -0,0 +1,11 @@ +// { dg-options "-std=c++0x" } + +#include + +template void f(std::initializer_list); + +void g() +{ + f({1,2,3}); +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist30.C b/gcc/testsuite/g++.dg/cpp0x/initlist30.C new file mode 100644 index 000000000..a5bdb2eda --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist30.C @@ -0,0 +1,12 @@ +// Testcase for variadic init list deduction. +// { dg-options "-std=c++0x" } + +#include + +template +void f (std::initializer_list... ls); + +int main() +{ + f({1},{2.0}); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist31.C b/gcc/testsuite/g++.dg/cpp0x/initlist31.C new file mode 100644 index 000000000..ffc985567 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist31.C @@ -0,0 +1,13 @@ +// PR c++/43028 +// { dg-options "-std=c++0x" } + +#include + +struct string { string(std::initializer_list) { } }; + +void f() { + auto y = + { + string(Equation()) // { dg-error "not declared" } + }; // { dg-error "unable to deduce" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist32.C b/gcc/testsuite/g++.dg/cpp0x/initlist32.C new file mode 100644 index 000000000..78bbb5ef9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist32.C @@ -0,0 +1,21 @@ +// Test that we try normal init if no list ctor is viable. +// { dg-options "-std=c++0x" } + +#include + +struct B {}; + +struct C +{ + C(B); +}; + +struct A +{ + A(std::initializer_list); + A(B) { } + A(C); +}; + +B b; +A a{b}; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist33.C b/gcc/testsuite/g++.dg/cpp0x/initlist33.C new file mode 100644 index 000000000..b1c0ba09b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist33.C @@ -0,0 +1,13 @@ +// PR c++/44045 +// { dg-options "-std=c++0x" } + +struct base +{ + virtual ~base() { } +}; + +int main() +{ + base ptr_array[1]; + ptr_array = { base() }; // { dg-error "assign" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist34.C b/gcc/testsuite/g++.dg/cpp0x/initlist34.C new file mode 100644 index 000000000..92f5a3a46 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist34.C @@ -0,0 +1,14 @@ +// PR c++/44157 +// { dg-options "-std=c++0x" } + +#include + +template +void f(T) { } + +int main() { + std::initializer_list a = { 0 }; + f(a); + + f >({ 0 }); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist35.C b/gcc/testsuite/g++.dg/cpp0x/initlist35.C new file mode 100644 index 000000000..e5b7cb4bd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist35.C @@ -0,0 +1,24 @@ +// PR c++/41510 +// { dg-options "-std=c++0x" } + +struct B +{ + B(int, int); +}; +struct A +{ + A(int, int); + A(const B&); +}; + +void f() +{ + A a = { 1, 2 }; +}; + +template void g() +{ + A a = { 1, 2 }; +}; + +template void g(); diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist36.C b/gcc/testsuite/g++.dg/cpp0x/initlist36.C new file mode 100644 index 000000000..94624c977 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist36.C @@ -0,0 +1,23 @@ +// PR c++/44358 +// { dg-options "-std=c++0x" } + +#include + +struct A +{ + A(int); +}; + +struct B +{ + B(std::initializer_list); +}; + +void f (B b); +int main() +{ + B b0 = {{1}}; + B b1 = {{1.0}}; // { dg-error "narrowing" } + B b2 {1.0}; // { dg-error "narrowing" } + A a {1.0}; // { dg-error "narrowing" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist37.C b/gcc/testsuite/g++.dg/cpp0x/initlist37.C new file mode 100644 index 000000000..20c6ab631 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist37.C @@ -0,0 +1,24 @@ +// DR 990 +// { dg-options "-std=c++0x" } + +#include + +struct S { + S(std::initializer_list); // #1 + S(std::initializer_list); // #2 + S(); // #3 + // ... +}; +S s1 = { 1.0, 2.0, 3.0 }; // invoke #1 +S s2 = { 1, 2, 3 }; // invoke #2 +S s3 = { }; // invoke #3 (for value-initialization) + + +// Test some other situations, too. +void f (S); +int main() +{ + S s4 { }; + f({ }); + S {}; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist38.C b/gcc/testsuite/g++.dg/cpp0x/initlist38.C new file mode 100644 index 000000000..32e20d591 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist38.C @@ -0,0 +1,21 @@ +// DR 990 +// { dg-options "-std=c++0x" } + +#include + +struct A { + A(std::initializer_list); // #1 +}; +struct B { + A a; +}; + +void f (B); +int main() +{ + B{}; + f({}); + B b0 = { }; + B b1 { }; // OK, uses #1 + B b2 { 1 }; // { dg-error "could not convert" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist39.C b/gcc/testsuite/g++.dg/cpp0x/initlist39.C new file mode 100644 index 000000000..a6dd1ec43 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist39.C @@ -0,0 +1,15 @@ +// { dg-options -std=c++0x } + +struct A { int i; }; + +void f (const A &); +void f (A &&); + +void g (A, int); +void g (A, double); + +int main() +{ + f ( { 1 } ); + g ( { 1 }, 1 ); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist4.C b/gcc/testsuite/g++.dg/cpp0x/initlist4.C new file mode 100644 index 000000000..d1ffab854 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist4.C @@ -0,0 +1,32 @@ +// Test for initializer-list 'explicit' rule +// { dg-options "-std=c++0x" } + +struct A +{ + explicit A(int,int); + operator bool(); +}; + +A f(A) +{ + A{1,2}; + A a1{1,2}; + new A{1,2}; + if (A a5{1,2}); + + A({1,2}); // { dg-error "explicit" } + A a2({1,2}); // { dg-error "explicit" } + A a3 = {1,2}; // { dg-error "explicit" } + new A({1,2}); // { dg-error "explicit" } + f({1,2}); // { dg-error "explicit" } + a1 = {1,2}; // { dg-error "explicit" } + if (A a4 = {1,2}); // { dg-error "explicit" } + return {1,2}; // { dg-error "explicit" } +} + +struct B +{ + A a; + B(): a{1,2} {} + B(const B&): a({1,2}) {} // { dg-error "explicit" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist40.C b/gcc/testsuite/g++.dg/cpp0x/initlist40.C new file mode 100644 index 000000000..f2703602c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist40.C @@ -0,0 +1,12 @@ +// { dg-options "-std=c++0x" } + +struct A +{ + explicit A(int = 42); +}; + +int main() +{ + A a1 = { }; + A a2 = { 24 }; // { dg-error "explicit" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist41.C b/gcc/testsuite/g++.dg/cpp0x/initlist41.C new file mode 100644 index 000000000..b5385480c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist41.C @@ -0,0 +1,14 @@ +// PR c++/44703 +// { dg-options -std=c++0x } + +#include + +typedef std::initializer_list type ; +void f(type) {} + +int main() +{ +// error: could not convert '{1, 2, 3}' to 'type' + f({1,2,3}) ; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist42.C b/gcc/testsuite/g++.dg/cpp0x/initlist42.C new file mode 100644 index 000000000..e63959deb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist42.C @@ -0,0 +1,13 @@ +// { dg-options -std=c++0x } + +enum Unscoped { }; +enum class Scoped { }; + +Unscoped bar(Unscoped x) { return x; } +Scoped bar(Scoped x) { return x; } + +auto var1u = bar(Unscoped()); // OK +auto var1s = bar(Scoped()); // OK + +auto var2u = bar(Unscoped{}); // #1 Error, but should work +auto var2s = bar(Scoped{}); // #2 Error, but should work diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist43.C b/gcc/testsuite/g++.dg/cpp0x/initlist43.C new file mode 100644 index 000000000..72a09bdea --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist43.C @@ -0,0 +1,7 @@ +// Test that using T{} at file scope doesn't create a static temporary. +// { dg-options -std=c++0x } +// { dg-final { scan-assembler-not "local" } } + +struct A { }; + +A a = A{}; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist44.C b/gcc/testsuite/g++.dg/cpp0x/initlist44.C new file mode 100644 index 000000000..fbe0ea3fe --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist44.C @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } + +#include + +auto value = std::initializer_list{ 1, 2, 3 }; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist45.C b/gcc/testsuite/g++.dg/cpp0x/initlist45.C new file mode 100644 index 000000000..0e34bc189 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist45.C @@ -0,0 +1,13 @@ +// PR c++/46289 +// { dg-options -std=c++0x } + +struct A +{ + int i[2]; +}; + +struct B +{ + A a; + B(): a({{1,2}}) { } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist46.C b/gcc/testsuite/g++.dg/cpp0x/initlist46.C new file mode 100644 index 000000000..2b9f07dbd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist46.C @@ -0,0 +1,14 @@ +// PR c++/48281 +// { dg-options "-std=c++0x -O2" } +// { dg-do run } + +#include + +typedef std::initializer_list int1; +typedef std::initializer_list int2; +static int2 ib = {{42,2,3,4,5},{2,3,4,5,1},{3,4,5,2,1}}; + +int main() +{ + return *(ib.begin()->begin()) != 42; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist47.C b/gcc/testsuite/g++.dg/cpp0x/initlist47.C new file mode 100644 index 000000000..b76fb5836 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist47.C @@ -0,0 +1,9 @@ +// { dg-options -std=c++0x } + +struct A { ~A() = delete; }; // { dg-error "declared" } + +int main() +{ + typedef const A cA[2]; + cA{}; // { dg-error "deleted" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist48.C b/gcc/testsuite/g++.dg/cpp0x/initlist48.C new file mode 100644 index 000000000..9eb451a82 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist48.C @@ -0,0 +1,11 @@ +// PR c++/48726 +// { dg-options -std=c++0x } + +#include + +struct Foo{ + int i; +}; +typedef std::unique_ptr up; + +std::initializer_list il{up{new Foo}, up{new Foo}}; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist5.C b/gcc/testsuite/g++.dg/cpp0x/initlist5.C new file mode 100644 index 000000000..32caac382 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist5.C @@ -0,0 +1,27 @@ +// Test for narrowing diagnostics +// { dg-options "-std=c++0x" } + +#include + +struct A { int i; int j; }; +A a2 { 1.2 }; // { dg-error "narrowing" } +A a1 { 1, 2 }; // aggregate initialization +struct B { + B(std::initializer_list); +}; +B b1 { 1, 2 }; // creates initializer_list and calls constructor +B b2 { 1, 2.0 }; // { dg-error "narrowing" } +struct C { + C(int i, double j); +}; +C c1 = { 1, 2.2 }; // calls constructor with arguments (1, 2.2) +C c2 = { 1.1, 2 }; // { dg-error "narrowing" } + +int j { 1 }; // initialize to 1 +int k {}; // initialize to 0 + +// PR c++/36963 +double d = 1.1; +float fa[] = { d, 1.1 }; // { dg-error "narrowing conversion of 'd'" } +constexpr double d2 = 1.1; +float fa2[] = { d2, 1.1 }; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist50.C b/gcc/testsuite/g++.dg/cpp0x/initlist50.C new file mode 100644 index 000000000..ef4e72c7c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist50.C @@ -0,0 +1,21 @@ +// PR c++/45418 +// { dg-options -std=c++0x } + +struct A1 { }; +struct A2 { + A2(); +}; + +template struct B { + T ar[1]; + B(T t):ar({t}) {} +}; + +int main(){ + B bi{1}; + A1 a1; + B ba1{a1}; + A2 a2; + A2 a2r[1]{{a2}}; + B ba2{a2}; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist51.C b/gcc/testsuite/g++.dg/cpp0x/initlist51.C new file mode 100644 index 000000000..9163dd3a8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist51.C @@ -0,0 +1,15 @@ +// PR c++/47184 +// { dg-options -std=c++0x } + +struct S +{ + int a; +}; +struct T +{ + T(S s) {} +}; +int main() +{ + T t(S{1}); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist57.C b/gcc/testsuite/g++.dg/cpp0x/initlist57.C new file mode 100644 index 000000000..d945a4689 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist57.C @@ -0,0 +1,8 @@ +// PR c++/50054 +// { dg-options -std=c++0x } + +void g( const int& (a)[1] ) {} // { dg-error "array of references" } + +int main () { + g( { 1, 2 } ); // { dg-error "initializer list" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist6.C b/gcc/testsuite/g++.dg/cpp0x/initlist6.C new file mode 100644 index 000000000..523570315 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist6.C @@ -0,0 +1,30 @@ +// Test for initlist lifetime +// { dg-options "-std=c++0x" } +// { dg-do run } + +#include + +int c; + +struct A +{ + A(int,int) { ++c; } + ~A() { --c; } +}; + +void f (std::initializer_list l) { } + +int main() +{ + f({ {1,2}, {3,4} }); + if (c != 0) + return 1; + + { + std::initializer_list l { {1,2}, {3,4} }; + if (c != 2) + return 2; + } + if (c != 0) + return 3; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist7.C b/gcc/testsuite/g++.dg/cpp0x/initlist7.C new file mode 100644 index 000000000..7913ed7ed --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist7.C @@ -0,0 +1,12 @@ +// PR c++/37932 +// { dg-options "-std=c++0x" } + +typedef enum { AA=1, BB=2 } my_enum; + +typedef struct { my_enum a:4 ; unsigned b:28; } stru; + +void foo (char c, my_enum x, int i) +{ + char arr[2] = {c+'0', 0}; // { dg-error "narrowing" } + stru s = {x,0}; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist8.C b/gcc/testsuite/g++.dg/cpp0x/initlist8.C new file mode 100644 index 000000000..db63eee78 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist8.C @@ -0,0 +1,19 @@ +// PR c++/37740 +// { dg-options "-std=c++0x" } + +struct A +{ + int i; +}; + +struct B +{ + double d; + A i; +}; + +int main() +{ + A a; + new B{3.2, a}; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist9.C b/gcc/testsuite/g++.dg/cpp0x/initlist9.C new file mode 100644 index 000000000..d596b3915 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist9.C @@ -0,0 +1,29 @@ +// PR c++/37860 +// { dg-options "-std=c++0x" } + +struct b +{ + bool t; + + b() = default; + ~b() = default; + b& operator=(const b&) = delete; + b(const b&) = delete; // { dg-error "declared" } + + b(bool _t): t (_t) { } +}; + +int main() +{ + // copy list initialization + b tst1 = { false }; + + // copy initialization. + b tst2 = false; // { dg-error "use" } + + // direct list initialization + b tst3 { false }; + + // default initialization + b tst4; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/inline-ns1.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns1.C new file mode 100644 index 000000000..e422d8970 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inline-ns1.C @@ -0,0 +1,12 @@ +// { dg-options -std=c++0x } +// { dg-final { scan-assembler "_ZN1Q2V11fEv" } } +// { dg-final { scan-assembler "_ZN1Q2V11iE" } } + +namespace Q { + inline namespace V1 { + extern int i; + void f(); + } +} +int Q::i = 1; +void Q::f() { } diff --git a/gcc/testsuite/g++.dg/cpp0x/inline-ns2.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns2.C new file mode 100644 index 000000000..03851725b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inline-ns2.C @@ -0,0 +1,25 @@ +// { dg-options -std=c++0x } + +namespace Q { + inline namespace V1 { + extern int i; // { dg-error "" } + extern int j; // { dg-error "" } + void f(); // { dg-error "" } + void g(); // { dg-error "" } + } + inline namespace V2 { + extern int j; // { dg-error "" } + void g(); // { dg-error "" } + } + extern int i; // { dg-error "" } + void f(); // { dg-error "" } + void h(); +} +namespace R { + using namespace Q; +} +int Q::i = 1; // { dg-error "ambiguous" } +int Q::j = 1; // { dg-error "ambiguous" } +void Q::f() { } // { dg-error "ambiguous" } +void Q::g() { } // { dg-error "ambiguous" } +void R::h() { } // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/cpp0x/inline-ns3.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns3.C new file mode 100644 index 000000000..7c9d6b9b5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inline-ns3.C @@ -0,0 +1,26 @@ +// { dg-options -std=c++0x } + +namespace C +{ + void f(); +} + +namespace B +{ + using namespace C; + + inline namespace B1 + { + void f(); + } +} + +namespace A +{ + using namespace B; +} + +int main() +{ + A::f(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/inline-ns4.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns4.C new file mode 100644 index 000000000..25caefc0a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inline-ns4.C @@ -0,0 +1,2 @@ +// { dg-options "-std=gnu++98 -pedantic" } +inline namespace { } // { dg-warning "inline namespaces" } diff --git a/gcc/testsuite/g++.dg/cpp0x/inline-ns5.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns5.C new file mode 100644 index 000000000..20a3dc6bb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inline-ns5.C @@ -0,0 +1,2 @@ +// { dg-options "-std=gnu++98 -pedantic-errors" } +inline namespace { } // { dg-error "inline namespaces" } diff --git a/gcc/testsuite/g++.dg/cpp0x/iop.C b/gcc/testsuite/g++.dg/cpp0x/iop.C new file mode 100644 index 000000000..834cd314a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/iop.C @@ -0,0 +1,41 @@ +// I, Howard Hinnant, hereby place this code in the public domain. + +// Test that the implicit object parameter is *not* an rvalue reference, but is instead +// identical to that specified in C++03. That is, the implicit object parameter is +// an lvalue reference that can bind to an rvalue. :-\ +// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html under the +// section "Revision 1 Summary and Rationale" for more details. + +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template struct sa; +template <> struct sa {}; + +struct one {long x[1];}; +struct two {long x[2];}; + +struct os +{ + one operator<<(int); +}; + +struct A +{ + A(int); +}; + +two operator<<(os&, const A&); + +void test() +{ + os o; + sa t1; // Calls os::operator<<(int) + // Would be ambiguous if the implicit object parameter + // was an rvalue reference. +} + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-50220.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-50220.C new file mode 100644 index 000000000..240143cf6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-50220.C @@ -0,0 +1,9 @@ +// PR c++/50220 +// { dg-options -std=c++0x } + +template struct Foobar {}; + +void foobar(const Foobar& obj) +{ + [obj](){}(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-98.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-98.C new file mode 100644 index 000000000..ff1085f30 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-98.C @@ -0,0 +1,8 @@ +// PR c++/46159 +// { dg-options -std=c++98 } + +void +f() +{ + int **p = new(int(*[2])); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array.C new file mode 100644 index 000000000..2129051ed --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array.C @@ -0,0 +1,20 @@ +// Test that array capture by copy works. +// { dg-options -std=c++0x } +// { dg-do run } + +struct A +{ + int i; + A(int i): i(i) {} + A(const A& a): i(a.i+1) {} +}; + +int main() +{ + A ar[4][3] = { { 10, 20, 30 }, + { 40, 50, 60 }, + { 70, 80, 90 }, + { 100, 110, 120 } }; + int i = [ar] { return ar[1][1]; }().i; + return (i!= 52); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-const-ref-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-const-ref-neg.C new file mode 100644 index 000000000..7d1a1bd89 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-const-ref-neg.C @@ -0,0 +1,14 @@ +// { dg-options "-std=c++0x" } +#include + +int main() { + int i = 1, j = 2; + const int& ci = i; + [&ci, &j] () -> void { j = ci; } (); + assert(i == 1); + assert(j == 1); + [&ci] () -> void { ci = 0; } (); // { dg-error "" "cannot assign to const int&" } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-const-ref.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-const-ref.C new file mode 100644 index 000000000..704c24085 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-const-ref.C @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } +#include + +int main() { + int i = 1, j = 2; + const int& ci = i; + [&ci, &j] () -> void { j = ci; } (); + assert(i == 1); + assert(j == 1); + //[&ci] () -> void { ci = 0; } (); { dg-error: cannot assign to const int& } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const-neg.C new file mode 100644 index 000000000..7e7541ca2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const-neg.C @@ -0,0 +1,19 @@ +// { dg-options "-std=c++0x" } + +#include + +template +void call(const F& f) { f(); } + +int main() { + call([] () -> void {}); + call([] () mutable -> void {}); + + int i = -1; + call([&i] () -> void { i = 0; }); + assert(i == 0); + call([i] () -> void { i = 0; }); // { dg-error "" "assignment to non-reference capture in const lambda" } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const.C new file mode 100644 index 000000000..5f6f0b3dc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const.C @@ -0,0 +1,20 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include + +template +void call(const F& f) { f(); } + +int main() { + call([] () -> void {}); + //call([] () mutable -> void {}); // { dg-error: "`f' does not have const `operator()'" } + + int i = -1; + call([&i] () -> void { i = 0; }); + assert(i == 0); + //call([i] () -> void { i = 0; }); // { dg-error: "assignment to non-reference capture in const lambda" } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C new file mode 100644 index 000000000..5409d5ca3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C @@ -0,0 +1,14 @@ +// Test for conversion from stateless lambda to function pointer. + +// { dg-options -std=c++0x } +// { dg-final { scan-assembler "weak\[^\n\r\]*_?_ZZ1fvENKUlvE_cvPFvvEEv" { target { ! { *-*-darwin* *-*-mingw* *-*-cygwin *-*-hpux10* } } } } } + +inline void f() +{ + void (*pfn)() = []{}; +} + +int main() +{ + f(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv2.C new file mode 100644 index 000000000..fc19c9969 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv2.C @@ -0,0 +1,12 @@ +// Test for conversion from stateless lambda to function pointer. + +// { dg-options -std=c++0x } +// { dg-do run } + +typedef int (*pfn)(int); + +int main() +{ + pfn p = [](int i) { return i-42; }; + return p (42); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv3.C new file mode 100644 index 000000000..e4e7daffd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv3.C @@ -0,0 +1,12 @@ +// Conversion to a function pointer uses a generic thunk, which doesn't +// work properly for variadics. Make sure that we can still use the lambda +// normally. + +// { dg-options -std=c++0x } + +void f() +{ + auto l = [](...){}; + void (*p1)(...) = l; // { dg-bogus "sorry" "" { xfail *-*-* } } + l(); // OK +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv4.C new file mode 100644 index 000000000..6584d28b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv4.C @@ -0,0 +1,13 @@ +// PR c++/43641 +// { dg-options "-std=c++0x" } + +struct B +{ + int i; +}; + +void func() +{ + [](const B& b) -> const int& { return b.i; }; + [](const B& b) { return b; }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv5.C new file mode 100644 index 000000000..53d8e995e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv5.C @@ -0,0 +1,15 @@ +// PR c++/45080 +// { dg-options -std=c++0x } + +typedef void(*pfn)(); + +template +void f() +{ + pfn fn = []{}; +} + +void test() +{ + f(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-default-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-default-neg.C new file mode 100644 index 000000000..1af2a95d8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-default-neg.C @@ -0,0 +1,13 @@ +// { dg-options "-std=c++0x" } + +int main() { + int i; + const char* s; + [=] () -> void { i; s; i; s; } (); + + [] () -> void { i; } (); // { dg-error "" "`i' is not captured" } + [1] () -> void {} (); // { dg-error "expected identifier" } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-default.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-default.C new file mode 100644 index 000000000..239a99cbf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-default.C @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +int main() { + int i; + const char* s; + [=] () -> void { i; s; i; s; } (); + + //[] () -> void { i; } (); // { dg-error: "`i' is not in scope" } + //[1] () -> void {} (); // { dg-error: "expected identifier" } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-neg.C new file mode 100644 index 000000000..d77e57e63 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-neg.C @@ -0,0 +1,13 @@ +// { dg-options "-std=c++0x" } + +int main() { + int i; + const char* s; + [i, s] () -> void { i; s; } (); + + [] () -> void { i; } (); // { dg-error "" "`i' is not captured" } + [1] () -> void {} (); // { dg-error "expected identifier" } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy.C new file mode 100644 index 000000000..7356872e1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy.C @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +int main() { + int i; + const char* s; + [i, s] () -> void { i; s; } (); + + //[] () -> void { i; } (); // { dg-error: "`i' is not in scope" } + //[1] () -> void {} (); // { dg-error: "expected identifier" } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C new file mode 100644 index 000000000..76ed7445f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C @@ -0,0 +1,25 @@ +// { dg-options -std=c++0x } + +void f() +{ + int i; + auto lam = [i]{}; // { dg-message "" } + decltype(lam) lam2 = { 1 }; // { dg-error "" "not an aggregate" } + decltype(lam) lam3; // { dg-error "" "deleted default ctor" } + lam3 = lam; // { dg-error "" "deleted assignment op" } +} + +template +void g(T i) +{ + auto lam = [i]{}; // { dg-message "" } + decltype(lam) lam2 = { 1 }; // { dg-error "" "not an aggregate" } + decltype(lam) lam3; // { dg-error "" "deleted default ctor" } + lam3 = lam; // { dg-error "" "deleted assignment op" } +} + +int main() +{ + f(); + g(1); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctors.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctors.C new file mode 100644 index 000000000..e263145b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctors.C @@ -0,0 +1,18 @@ +// { dg-options -std=c++0x } +// { dg-do run } + +struct A +{ + A() { } + A(A&) { } + A(A&&) { } +}; + +int main() +{ + A a; + auto lam4 = [a]{}; // OK, implicit move ctor + lam4(); + auto lam5 = lam4; // OK, implicit copy ctor + lam5(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-debug.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-debug.C new file mode 100644 index 000000000..07fc1896c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-debug.C @@ -0,0 +1,15 @@ +// PR c++/43502 +// { dg-options "-std=c++0x -fcompare-debug" } + +void g (int n) +{ + int bef ([]{return 0;}()); +} +struct S { + void f (int = []{return 0;}(), int = [] { return 0;}()); +}; +int main () +{ + S ().f (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg.C new file mode 100644 index 000000000..bfe7acab6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg.C @@ -0,0 +1,24 @@ +// Testcase for an extension to allow return type deduction when the lambda +// contains more than just a single return-statement. + +// { dg-options -std=c++0x } + +bool b; +template +T f (T t) +{ + return [=] + { + auto i = t+1; + if (b) + return i+1; + else + return i+2; // { dg-error "lambda return type" } + }(); +} + +int main() +{ + if (f(1) != 3) + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg2.C new file mode 100644 index 000000000..a236e6d11 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg2.C @@ -0,0 +1,22 @@ +// Test that in pedantic mode, we warn about the extension to allow return +// type deduction when the lambda contains more than just a single +// return-statement. + +// { dg-options "-std=c++0x -pedantic" } + +bool b; +template +T f (T t) +{ + [=] { return t+1; }; // OK + return [=] { + auto i = t+1; + return i+1; // { dg-warning "only statement" } + }(); +} + +int main() +{ + if (f(1) != 3) + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext.C new file mode 100644 index 000000000..9b5ab7983 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext.C @@ -0,0 +1,27 @@ +// Testcase for an extension to allow return type deduction when the lambda +// contains more than just a single return-statement. + +// { dg-options -std=c++0x } +// { dg-do run } + +bool b; +template +T f (T t) +{ + return [=] { + auto i = t+1; + if (b) + return i+1; + else + return i+1; + }(); +} + +int main() +{ + // Pointless, but well-formed. + [] { return 1; return 2; }(); + + if (f(1) != 3) + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-neg.C new file mode 100644 index 000000000..4abdf59a6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-neg.C @@ -0,0 +1,10 @@ +// { dg-options "-std=c++0x" } +#include + +int main() { + int i = 0; + int& r = [&] () { return i; } (); // { dg-error "" "invalid initialization of non-const reference of type .int&. from a temporary of type .int." } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce.C new file mode 100644 index 000000000..cc5cc5402 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce.C @@ -0,0 +1,29 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } +#include + +int main() { + [] {}; + [] {} (); + [] () {}; + [] () {} (); + [] () { return "lambda"; }; + + int i = 1, j = 2; + [&i, j] () { i = j; } (); + assert(i == 2); + assert(j == 2); + + i = [] () { return 3; } (); + assert(i == 3); + + int k = [&] () { return i; } (); + + []{ return; }; + + int array[] = { 1, 2, 3 }; + int* p = [&] () { return array; } (); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C new file mode 100644 index 000000000..718d49cd9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C @@ -0,0 +1,7 @@ +// PR c++/43875 +// { dg-options "-std=c++0x" } + +int main() +{ + auto x2 = []{ return { 1, 2 }; }; // { dg-message "return" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg.C new file mode 100644 index 000000000..069935823 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg.C @@ -0,0 +1,6 @@ +// { dg-options "-std=c++0x -pedantic-errors" } + +int main() +{ + [](int a = 1) { return a; }(); // { dg-error "" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg2.C new file mode 100644 index 000000000..f47c5ba27 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg2.C @@ -0,0 +1,7 @@ +// PR c++/43886 +// { dg-options -std=c++0x } + +void f2() { + int i = 1; + void g5(int = ([]{ return sizeof i; })()); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-direct-init.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-direct-init.C new file mode 100644 index 000000000..bbc2a1ca5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-direct-init.C @@ -0,0 +1,14 @@ +// Test that capture by copy uses direct-initialization. +// { dg-options "-std=c++0x" } + +struct A +{ + A(); + explicit A(const A&); +}; + +int main() +{ + A a; + [a]{}; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C new file mode 100644 index 000000000..ea5060d1a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C @@ -0,0 +1,35 @@ +// Test that we properly clean up if we get an exception in the middle of +// constructing the closure object. +// { dg-options -std=c++0x } + +// This test fails because of PR 41449; it isn't a lambda issue. +// { dg-do run { xfail *-*-* } } + +struct A +{ + A() {} + A(const A&) { throw 1; } +}; + +int bs; +struct B +{ + B() { ++bs; } + B(const B&) { ++bs; } + ~B() { --bs; } +}; + +int main() +{ + { + B b1, b2; + A a; + + try + { + [b1, a, b2]{ }; + } + catch(...) {} + } + return bs; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C new file mode 100644 index 000000000..0c94b554f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C @@ -0,0 +1,17 @@ +// PR c++/47263 +// PR c++/49260 +// { dg-options "-std=c++0x -fno-asynchronous-unwind-tables -fno-dwarf2-cfi-asm" } +// { dg-do run } + +#include + +int main( void ) +{ + std::set_unexpected( []{ throw 0; } ); + try + { + []() throw( int ) { throw nullptr; }(); + } + catch( int ) + { } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C new file mode 100644 index 000000000..f4766691e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C @@ -0,0 +1,18 @@ +// Test that error messages about creating the closure object refer to +// the lambda-introducer. +// { dg-options -std=c++0x } + +struct A +{ + A(); + A(const A& a) = delete; // { dg-error "declared" } +}; + +int main() +{ + A ar[4][3]; + [ar] { }; // { dg-error "3:" } + + A a; + [a] { }; // { dg-error "3:" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C new file mode 100644 index 000000000..dab53f127 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C @@ -0,0 +1,19 @@ +// PR c++/42399 +// { dg-options "-std=c++0x" } + +struct A { + A(); + A(const A&) = delete; // { dg-error "declared" } +}; + +template +void f() +{ + T t; + [t] { return 0; }; // { dg-error "use" } +} + +int main() +{ + f(); // { dg-message "instantiated" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-field-names.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-field-names.C new file mode 100644 index 000000000..b292d8898 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-field-names.C @@ -0,0 +1,21 @@ +// "For each entity captured by copy, an unnamed non-static data member is +// declared in the closure type" -- test that there isn't a member of the +// closure with the same name as the captured variable. + +// { dg-options -std=c++0x } + +template +struct A: public T +{ + A(T t): T(t) { } + int f() { return this->i; } // { dg-error "" "no member named i" } +}; + +int main() +{ + int i = 42; + auto lam = [i]{ }; + lam.i = 24; // { dg-error "" "no member named i" } + A a(lam); + return a.f(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice1.C new file mode 100644 index 000000000..1ea8f4d7b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice1.C @@ -0,0 +1,13 @@ +// PR c++/43790 +// { dg-options "-std=c++0x" } + +struct A +{ + int f(); +}; + +int main() +{ + A a; + auto l = [] () { return a.f(); }; // { dg-error "not captured|return" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C new file mode 100644 index 000000000..352137aad --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C @@ -0,0 +1,16 @@ +// PR c++/42083 +// { dg-options "-std=c++0x" } + +template +decltype(F()) run(F f) // { dg-message "note" } +{ + return f(); +} + +int main() +{ + auto l = []() { return 5; }; + + run(l); // { dg-error "no match" } + // { dg-message "candidate" "candidate note" { target *-*-* } 14 } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C new file mode 100644 index 000000000..8ff36478d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C @@ -0,0 +1,23 @@ +// PR c++/47795 +// { dg-options "-std=c++0x" } + +class Klass +{ + unsigned int local; +public: + bool dostuff(); +}; + +bool Klass::dostuff() +{ + auto f = []() -> bool { + if (local & 1) { return true; } // { dg-error "not captured" } + return false; + }; +} + +int main() +{ + Klass c; + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice4.C new file mode 100644 index 000000000..77c773bbd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice4.C @@ -0,0 +1,14 @@ +// PR c++/47242 +// { dg-options "-std=c++0x" } + +template < typename > void +bar () +{ + [i]{}; // { dg-error "declared|invalid" } +} + +void +foo () +{ + bar(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class-neg.C new file mode 100644 index 000000000..a93857e46 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class-neg.C @@ -0,0 +1,35 @@ +// { dg-options "-std=c++0x" } + +#include + +class C { + private: + int m_i; + + public: + C() : m_i(-1) { + [] { this; } (); // { dg-error "not captured" } + [this] () -> void { m_i = 0; } (); + assert(m_i == 0); + [this] () -> void { this->m_i = 1; } (); + assert(m_i == 1); + [&] () -> void { m_i = 2; } (); + assert(m_i == 2); + [&] () -> void { this->m_i = 3; } (); + assert(m_i == 3); + [=] () -> void { m_i = 4; } (); // copies 'this' or --copies-m_i--? + assert(m_i == 4); + [=] () -> void { this->m_i = 5; } (); + assert(m_i == 5); + } + +}; + +int main() { + C c; + + [this] () -> void {} (); // { dg-error "use of 'this' in non-member function" } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class.C new file mode 100644 index 000000000..33f4301e4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class.C @@ -0,0 +1,36 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include + +class C { + private: + int m_i; + + public: + C() : m_i(-1) { + //[] { this; } (); + [this] () -> void { m_i = 0; } (); + assert(m_i == 0); + [this] () -> void { this->m_i = 1; } (); + assert(m_i == 1); + [&] () -> void { m_i = 2; } (); + assert(m_i == 2); + [&] () -> void { this->m_i = 3; } (); + assert(m_i == 3); + [=] () -> void { m_i = 4; } (); // copies 'this' or --copies-m_i--? + assert(m_i == 4); + [=] () -> void { this->m_i = 5; } (); + assert(m_i == 5); + } + +}; + +int main() { + C c; + + //[this] () -> void {} (); // { dg-error: "cannot capture `this' outside of class method" } + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-init.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-init.C new file mode 100644 index 000000000..03c94e959 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-init.C @@ -0,0 +1,8 @@ +// Test for the explicit initializer extension +// { dg-options "-std=c++0x" } + +int main() +{ + int j = [i = 2]{sizeof(i); return i;}(); + return (j != 2); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-lookup-neg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-lookup-neg.C new file mode 100644 index 000000000..e07e892a1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-lookup-neg.C @@ -0,0 +1,7 @@ +// Test that we don't crash on a failed lookup. +// { dg-options -std=c++0x } + +int main() +{ + [i]{}; // { dg-error "not declared" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle.C new file mode 100644 index 000000000..5c9b483d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle.C @@ -0,0 +1,103 @@ +// Test lambda mangling +// { dg-require-weak "" } +// { dg-options "-std=c++0x -fno-inline" } + +template int algo(F fn) { return fn(); } +inline void g(int n) { + int bef(int i = []{ return 1; }()); + // Default arguments of block-extern function declarations + // remain in the context of the encloding function body. + // The closure type is encoded as Z1giEUlvE_. + // The call operator of that type is _ZZ1giENKUlvE_clEv. + +// { dg-final { scan-assembler "_ZZ1giENKUlvE_clEv" } } +// { dg-final { scan-assembler "weak\[^\n\r\]*_?_ZZ1giENKUlvE_clEv" { target { ! { *-*-darwin* *-*-mingw* *-*-cygwin } } } } } + + algo([=]{return n+bef();}); + // The captured entities do not participate in + // and so this closure type has the same as + // the previous one. It encoding is therefore Z1giEUlvE0_ + // and the call operator is _ZZ1giENKUlvE0_clEv. The + // instance of "algo" being called is then + // _Z4algoIZ1giEUlvE0_EiT_. + +// { dg-final { scan-assembler "_Z4algoIZ1giEUlvE0_EiT_" } } +// { dg-final { scan-assembler "_ZZ1giENKUlvE0_clEv" } } + + int i = []{return 1;}(); + +} + +struct S { + void f(int = + // Type: ZN1S1fEiiEd0_UlvE_ + // Operator: _ZZN1S1fEiiEd0_NKUlvE_clEv +// { dg-final { scan-assembler "_ZZN1S1fEiiEd0_NKUlvE_clEv" } } +// { dg-final { scan-assembler "weak\[^\n\r\]*_?_ZZN1S1fEiiEd0_NKUlvE_clEv" { target { ! { *-*-darwin* *-*-mingw* *-*-cygwin } } } } } + []{return 1;}() + // Type: ZN1S1fEiiEd0_UlvE0_ + // Operator: _ZZN1S1fEiiEd0_NKUlvE0_clEv +// { dg-final { scan-assembler "_ZZN1S1fEiiEd0_NKUlvE0_clEv" } } + + []{return 2;}(), + int = + // Type: ZN1S1fEiiEd_UlvE_ + // Operator: _ZZN1S1fEiiEd_NKUlvE_clEv +// { dg-final { scan-assembler "_ZZN1S1fEiiEd_NKUlvE_clEv" } } + []{return 3;}()); +}; + +template struct R { + static int x; +}; +template int R::x = []{return 1;}(); +template int R::x; +// Type of lambda in intializer of R::x: N1RIiE1xMUlvE_E +// Corresponding operator(): _ZNK1RIiE1xMUlvE_clEv +// { dg-final { scan-assembler "_ZNK1RIiE1xMUlvE_clEv" } } +// { dg-final { scan-assembler "weak\[^\n\r\]*_?_ZNK1RIiE1xMUlvE_clEv" { target { ! { *-*-mingw* *-*-cygwin } } } } } + +void bar() +{ + // lambdas in non-vague linkage functions have internal linkage. + // { dg-final { scan-assembler-not "weak\[^\n\r\]*bar\[^\n\r\]*Ul" } } + []{}(); +} + +// lambdas used in non-template, non-class body initializers are internal. +// { dg-final { scan-assembler-not "weak\[^\n\r\]*_ZNKUlv" } } +// { dg-final { scan-assembler-not "weak\[^\n\r\]*variable" } } +int variable = []{return 1;}(); + +// And a template instantiated with such a lambda is also internal. +// { dg-final { scan-assembler-not "weak\[^\n\r\]*algoIUl" } } +int var2 = algo([]{return 1;}); + +// As are lambdas used in non-class-body default arguments. +// { dg-final { scan-assembler-not "weak\[^\n\r\]*function" } } +void function (int i = []{return 1;}()+[]{return 1;}()); + +struct Foo +{ + static int Int; + void Bar(int); +}; + +int Foo::Int = []{return 1;}(); +// Even default arguments for member functions that appear outside the +// class body are internal. +// { dg-final { scan-assembler-not "weak\[^\n\r\]*Foo" } } +void Foo::Bar(int i = []{return 1;}()) {} + +// Even default arguments for function templates. +// { dg-final { scan-assembler-not "weak\[^\n\r\]*fn2\[^\n\r\]*Ulv" } } +template +void fn2 (T t = []{return 1;}()) {} + +int main() +{ + g(42); + S().f(); + function(); + Foo().Bar(); + fn2(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C new file mode 100644 index 000000000..4b7d15ad9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C @@ -0,0 +1,21 @@ +// PR c++/49276 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template +struct F +{ + template F (U); +}; + +struct S +{ + void foo (F <0> x = [] {}) {} +}; + +int +main () +{ + S s; + s.foo (); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mixed.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mixed.C new file mode 100644 index 000000000..ed0565fa9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mixed.C @@ -0,0 +1,13 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } +#include + +int main() { + int i = 1, j = 2; + [&i, j] () mutable -> void { i = 0; j = 0; } (); + assert(i == 0); + assert(j == 2); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable.C new file mode 100644 index 000000000..73a4d1bac --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable.C @@ -0,0 +1,16 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } +#include + +int main() { + int i = 1; + const char* s1 = "hello"; + const char* s2 = s1; + [i, s2] () mutable -> void { i = 2; s2 = "world"; } (); + //[i, s2] () -> void { i = 2; s2 = "world"; } (); // { dg-error: "assignment of data-member in read-only structure" } + assert(i == 1); + assert(s1 == s2); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested.C new file mode 100644 index 000000000..feb0cde59 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested.C @@ -0,0 +1,63 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include + +struct A { + int i; + A(): i(42) { } + int f() { + return [this]{ + return [=]{ return i; }(); + }(); + } +}; + +int main() { + int i = 1; + + [] (int& i) -> void { + [&] () -> void { + i = 2; + } (); + } (i); + + assert(i == 2); + + [&] () -> void { + [&i] () -> void { + i = 3; + } (); + } (); + + assert(i == 3); + + [&] () -> void { + [&] () -> void { + i = 4; + } (); + } (); + + assert(i == 4); + i = 4; + + [&] () -> void { + [=] () mutable -> void { + i = 5; + } (); + } (); + + assert(i == 4); + + [=] () mutable -> void { + [&] () -> void { + i = 6; + } (); + } (); + + assert(i == 4); + + assert (A().f() == 42); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C new file mode 100644 index 000000000..b78874855 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C @@ -0,0 +1,31 @@ +// Testcase from N2998 +// { dg-options -std=c++0x } + +void f1(int i) { + int const N = 20; + auto m1 = [=]{ + int const M = 30; + auto m2 = [i]{ + int x[N][M]; // OK: N and M are not "used" + x[0][0] = i; // OK: i is explicitly captured by m2 + // and implicitly captured by m1 + }; + }; + struct s1 { + int f; + int work(int n) { + int m = n*n; + int j = 40; + auto m3 = [this,m]{ + /*auto m4=*/[&,j]{ // { dg-error "j. is not captured" } + int x = n; // { dg-error "n. is not captured" } + x += m; // OK: m implicitly captured by m4 + // and explicitly captured by m3 + x += i; // { dg-error "i. is not captured" } + x += f; // OK: this captured implicitly by m4 + // and explicitly by m3 + }; + }; + } + }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested3.C new file mode 100644 index 000000000..2cc6f9640 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested3.C @@ -0,0 +1,12 @@ +// PR c++/41896 +// { dg-options "-std=c++0x" } + +void nested_lambda() +{ + float val; + + [val]() + { + [val](){}; + }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C new file mode 100644 index 000000000..b6489de4b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C @@ -0,0 +1,19 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include + +template +void call(F f) { f(); } + +int main() { + call([] () -> void {}); + call([] () mutable -> void {}); + + int i = -1; + call([i] () mutable -> void { i = 0; }); + assert(i == -1); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C new file mode 100644 index 000000000..74149b231 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C @@ -0,0 +1,19 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } +#include + +int main() { + int i = 1, j = 2; + [i, j] () -> void {} (); + assert(i == 1); + assert(j == 2); + [&i, &j] () -> void {} (); + assert(i == 1); + assert(j == 2); + [] (int x) -> void {} (1); + [] (int& x) -> void {} (i); + [] (int x, int y) -> void {} (i, j); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ns-scope.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ns-scope.C new file mode 100644 index 000000000..cde0c2e53 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ns-scope.C @@ -0,0 +1,18 @@ +// { dg-options -std=c++0x } +// { dg-do run } + +auto f = [](int i) { return i+1; }; + +int g(int i = [] { return 237; }()) +{ + return i; +} + +int main() +{ + if (f(41) != 42) + return 1; + if (g() != 237) + return 2; + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-pass.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-pass.C new file mode 100644 index 000000000..9dd64484a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-pass.C @@ -0,0 +1,27 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include +#include + +template +void call(F f, const A1& arg1) { + f(arg1); +} + +int main() { + int i = 1; + call( + [&i] (int j) -> void { i = j; }, + 2 + ); + assert(i == 2); + + int A[] = {1, 2, 3, 4}; + int sum = 0; + std::for_each(A, A+4, [&sum] (int n) -> void { sum += n; }); + assert(sum == 10); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C new file mode 100644 index 000000000..ef041c2bb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C @@ -0,0 +1,17 @@ +// PR c++/50089 +// { dg-options -std=c++0x } + +struct TestBase +{ + void foo() {} +}; + +struct Test : TestBase +{ + void foo() + { + [this]{ + /*this->*/TestBase::foo(); // ICE without this-> + }(); + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-recursive.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-recursive.C new file mode 100644 index 000000000..1a12eab31 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-recursive.C @@ -0,0 +1,21 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +//#include +#include +#include + +int main() { + + std::function fib = [&fib] (int n) -> int { + //std::cerr << "fib(" << n << ")\n"; + if (n <= 2) return 1; + else return fib(n-1) + fib(n-2); + }; + + assert(fib(5) == 5); + assert(fib(10) == 55); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref-default.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref-default.C new file mode 100644 index 000000000..40376f43d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref-default.C @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include + +int main() { + int i = 1; + float j = 2.0; + [&] () -> void { i = 3; j = 4.0; } (); + assert(i == 3); + assert(j == 4.0); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref.C new file mode 100644 index 000000000..a5ee7b4c3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref.C @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include + +int main() { + int i = 1; + float j = 2.0; + [&i, &j] () -> void { i = 3; j = 4.0; } (); + assert(i == 3); + assert(j == 4.0); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref2.C new file mode 100644 index 000000000..15f1d9034 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref2.C @@ -0,0 +1,13 @@ +// PR c++/49598 +// { dg-options -std=c++0x } +// { dg-do run } + +int +main() +{ + int i = 10; + int& ir = i; + + if ([=]{ return ir; }() != 10) + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-std-function.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-std-function.C new file mode 100644 index 000000000..26c09fdb1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-std-function.C @@ -0,0 +1,22 @@ +// Test using std::function wrapper. +// { dg-do run } +// { dg-options -std=c++0x } + +#include + +typedef std::function FN; + +template +FN f(T fn) +{ + return [fn]{return fn(2);}; +} + +int main() +{ + auto fn = f([](int i){return i*21;}); + + if (fn() != 42) + return 1; + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C new file mode 100644 index 000000000..b4db3b881 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C @@ -0,0 +1,41 @@ +// { dg-options -std=c++0x } +// { dg-do run } + +extern "C" void abort(); + +template +auto apply (T t) -> decltype (t()) +{ + return t(); +} + +template +T f(T t) +{ + T t2 = t; + if (t != [=]()->T { return t; }()) + abort (); + if (t != [=] { return t; }()) + abort (); + if (t != [=] { return t2; }()) + abort (); + if (t != [&] { return t; }()) + abort (); + if (t != apply([=]{return t;})) + abort (); + + int i; + [&] (int a) { return a+i+t; } (0); + [&] (int a) -> decltype(a) { return a+i+t; } (0); + [&] (int a) -> decltype(i) { return a+i+t; } (0); + [&] (int a) -> decltype(t) { return a+i+t; } (0); + [&] (int a) -> decltype(a+i) { return a+i+t; } (0); + [&] (int a) -> decltype(a+t) { return a+i+t; } (0); + [&] (int a) -> decltype(i+t) { return a+i+t; } (0); + [&] (int a) -> decltype(a+i+t) { return a+i+t; } (0); +} + +int main() +{ + f(0xbeef); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C new file mode 100644 index 000000000..12ffde724 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C @@ -0,0 +1,20 @@ +// PR c++/47049 +// { dg-options -std=c++0x } + +enum { E = 0, F = 1 }; +template class S {}; +template +struct T +{ + static void + foo (S *p) + { + S u; + [&u] ()->bool {} (); + } +}; + +int main() +{ + T<0>().foo(0); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C new file mode 100644 index 000000000..ed2747654 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C @@ -0,0 +1,13 @@ +// Test that implicit 'this' capture works, but that it's still an rvalue. +// { dg-options -std=c++0x } + +struct A +{ + int i; + void f() + { + [=] { i = 0; }; + [&] { i = 0; }; + [=] { this = 0; }; // { dg-error "lvalue" } + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C new file mode 100644 index 000000000..04fe474c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C @@ -0,0 +1,17 @@ +// PR c++/43856 +// Test for implicit 'this' capture via rewriting. +// { dg-options "-std=c++0x" } + +struct S1 { + int operator()(int); + int i; + void g(); + void f() { + [=]() { + i; + g(); + S1::g(); + operator()(42); + }; + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this3.C new file mode 100644 index 000000000..de0d357f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this3.C @@ -0,0 +1,14 @@ +// PR c++/45520 +// { dg-options -std=c++0x } + +struct M { + int i; +}; + +struct S { + M m; + + void f() { + auto lambda=[&](decltype(m.i) & i) { }; + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C new file mode 100644 index 000000000..29cd2a97b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C @@ -0,0 +1,13 @@ +// PR c++/48523 +// { dg-options -std=c++0x } + +template +struct X +{ + bool b; + + void f() + { + [this]{ return b; }; + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-type.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-type.C new file mode 100644 index 000000000..3b2a2a76a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-type.C @@ -0,0 +1,74 @@ +// Every id-expression that is a use (_basic.def.odr_ 3.2) of an entity +// captured by copy is transformed into an access to the corresponding +// unnamed data member of the closure type. +//... +// Every occurrence of decltype((x)) where x is a possibly parenthesized +// id-expression that names an entity of automatic storage duration is +// treated as if x were transformed into an access to a corresponding data +// member of the closure type that would have been declared if x were a use +// of the denoted entity. + +// So, other appearances of 'x' within decltype do not refer to the closure +// member, because they are not "use"s in the sense of 3.2. + +// { dg-options -std=c++0x } + +template +struct same_type; +template +struct same_type { }; + +int main() +{ + int i; + [=] { + same_type(); + same_type(); + i+1; + same_type(); + same_type(); + }; + [=] { + same_type(); + same_type(); + same_type(); + }; + [=] () mutable { + same_type(); + same_type(); + same_type(); + }; + [&] { + same_type(); + same_type(); + same_type(); + }; + [i] { + same_type(); + same_type(); + }; + [&,i] { + same_type(); + same_type(); + }; + [i] () mutable { + same_type(); + same_type(); + }; + [&,i] () mutable { + same_type(); + same_type(); + }; + [&i] { + same_type(); + same_type(); + }; + [=,&i] { + same_type(); + same_type(); + }; + [] { + same_type(); + same_type(); // { dg-error "" "not captured" } + }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-uneval.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-uneval.C new file mode 100644 index 000000000..33ba7b0a4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-uneval.C @@ -0,0 +1,7 @@ +// 5.1.2/2: A lambda-expression shall not appear in an unevaluated operand. +// { dg-options "-std=c++0x" } + +template +struct A { }; +A a; // { dg-error "lambda.*unevaluated context" } + diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use.C new file mode 100644 index 000000000..b1d6c300c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use.C @@ -0,0 +1,12 @@ +// { dg-options -std=c++0x } + +int main(int argc, char** argv) +{ + int i; + int &ir = i; + const int ci = 0; + const int &cir = ci; + + [] { sizeof (argc); sizeof (i); sizeof (ir); sizeof (ci); sizeof (cir); }; + [] { int ia[ci]; }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use2.C new file mode 100644 index 000000000..695a0b432 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use2.C @@ -0,0 +1,11 @@ +// PR c++/50224 +// { dg-options "-std=c++0x -Wunused-parameter" } + +struct T; + +void m(T& t) // ERROR here +{ + [&]{ + t; // ``t`` is referenced here + }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic1.C new file mode 100644 index 000000000..f17b33618 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic1.C @@ -0,0 +1,15 @@ +// PR c++/49672 +// { dg-options -std=c++0x } + +template +static void foo() +{ + [](Args..., int x) { + x; + }; +} + +int main() +{ + foo(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn1.C new file mode 100644 index 000000000..b384d5cff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn1.C @@ -0,0 +1,8 @@ +// PR c++/41920 +// { dg-options "-std=c++0x -Wall -Wextra" } + +int foo(int i) +{ + auto bar = [=](){ return i; }; + return bar(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn2.C new file mode 100644 index 000000000..ce5e7c450 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn2.C @@ -0,0 +1,7 @@ +// PR c++/42370 +// { dg-options "-std=c++0x -Wall" } + +void foo() +{ + []{ return 0; }(); +} // { dg-bogus "no return statement" } diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C new file mode 100644 index 000000000..77f35bc46 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C @@ -0,0 +1,12 @@ +// PR c++/49482 +// { dg-options "-std=c++0x -Wunused-but-set-parameter" } + +template +void f() { + []( bool b ){ return b; }; +} + +int main() +{ + f(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/linkage2.C b/gcc/testsuite/g++.dg/cpp0x/linkage2.C new file mode 100644 index 000000000..f41c21a77 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/linkage2.C @@ -0,0 +1,33 @@ +// DR 743: A type without linkage shall not be used as the type of a +// variable or function with linkage, unless +// o the variable or function has extern "C" linkage (7.5 [dcl.link]), or +// o the variable or function is not used (3.2 [basic.def.odr]) or is +// defined in the same translation unit. + +// { dg-options -std=c++0x } + +template struct B { + void g(T){} + void h(T); // { dg-error "never defined" } + friend void i(B, T){} + static T t1; // { dg-error "never defined" } + static T t2; +}; + +template T B::t2 = { }; + +enum {} e1; // OK, defined +extern enum {} e2; // { dg-error "never defined" } +extern "C" enum {} e3; // OK, extern "C" + +void f() { + struct A { int x; }; // no linkage + A a = {1}; + B ba; // declares B::g(A) and B::h(A) + ba.t1 = a; // error, B::t never defined + ba.t2 = a; // OK + ba.g(a); // OK + ba.h(a); // error, B::h never defined + i(ba, a); // OK + e1+e2+e3; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/long_long.C b/gcc/testsuite/g++.dg/cpp0x/long_long.C new file mode 100644 index 000000000..3ef710df4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/long_long.C @@ -0,0 +1,6 @@ +// { dg-options "-std=c++0x -pedantic" } + +void foo() +{ + long long x = 17; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/move1.C b/gcc/testsuite/g++.dg/cpp0x/move1.C new file mode 100644 index 000000000..12e363a8c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/move1.C @@ -0,0 +1,15 @@ +// { dg-options "-std=c++0x -pedantic-errors" } + +#include + +class A { }; + +static void g ( A && ) { } + +template < class T > class B { +public: + void f ( ) { + A a; + g ( std :: move ( a ) ); + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/named.C b/gcc/testsuite/g++.dg/cpp0x/named.C new file mode 100644 index 000000000..ef1a2fb6f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/named.C @@ -0,0 +1,40 @@ +// { dg-options "--std=c++0x" } +// { dg-do link } + +template +inline _Tp&& +movel(_Tp& __t) +{ return static_cast<_Tp&&>(__t); } + +struct S {}; +struct T +{ + T(S && s_) : s(movel(s_)) {} + S && get() { return movel(s); } + operator S&&() { return movel(s); } + S && s; +}; + +void named(S const &) {} +void named(S&&); + +void unnamed(S const &); +void unnamed(S&&) {} + +void f(S && p) +{ + S && s(movel(p)); + T t(movel(s)); + + named(s); // variable reference + named(p); // parameter reference + named(t.s); // class member access + + unnamed(t.get()); // function return + unnamed(t); // implicit conversion + unnamed(static_cast(s)); // cast to rvalue +} + +int main() +{ +} diff --git a/gcc/testsuite/g++.dg/cpp0x/named_refs.C b/gcc/testsuite/g++.dg/cpp0x/named_refs.C new file mode 100644 index 000000000..697867e11 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/named_refs.C @@ -0,0 +1,28 @@ +// I, Howard Hinnant, hereby place this code in the public domain. + +// Test: Named rvalue references are treated as lvalues. + +// { dg-do compile } +// { dg-options "-std=c++0x" } + +template struct sa; +template <> struct sa {}; + +struct one {long x[1];}; +struct two {long x[2];}; + +struct A {}; + +one foo(const A&) {return one();} +two foo(A&&) {return two();} + +int test1(A&& a) +{ + sa t1; + return 0; +} + +int main() +{ + return test1(A()); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept01.C b/gcc/testsuite/g++.dg/cpp0x/noexcept01.C new file mode 100644 index 000000000..f314684ea --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept01.C @@ -0,0 +1,83 @@ +// Test for noexcept-expression +// { dg-options "-std=c++0x -O2" } + +#include + +#define SA(X) static_assert(X, #X) + +void f(); +void g() throw(); +SA(noexcept(g())); +SA(!noexcept(f())); +SA(!noexcept(throw 1)); +SA(noexcept(42)); + +struct A +{ + virtual ~A(); +}; + +struct B: public A +{ + virtual ~B(); +}; + +A* ap; + +struct C { }; +C* cp; + +SA (noexcept (dynamic_cast(ap))); +SA (!noexcept (dynamic_cast(*ap))); +SA (!noexcept (typeid (*ap))); +SA (noexcept (typeid (*cp))); + +SA (!noexcept (true ? 1 : throw 1)); +SA (!noexcept (true || true ? 1 : throw 1)); + +SA (noexcept (C())); + +struct D +{ + D() throw(); +}; + +SA (noexcept (D())); + +struct E +{ + E() throw(); + ~E(); +}; + +SA (!noexcept (E())); + +struct F +{ + virtual void f(); +}; + +SA (noexcept (F())); + +struct G +{ + G() = default; + ~G() = default; +}; + +SA (noexcept (G())); + +template +void tf() +{ + SA (noexcept (T()) == b); +} + +template void tf(); +template void tf(); + +// Make sure that noexcept uses the declared exception-specification, not +// any knowledge we might have about whether or not the function really +// throws. +void h() { } +SA(!noexcept(h())); diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept02.C b/gcc/testsuite/g++.dg/cpp0x/noexcept02.C new file mode 100644 index 000000000..ffbb09192 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept02.C @@ -0,0 +1,54 @@ +// Test for noexcept-specification +// { dg-options "-std=c++0x" } + +#define SA(X) static_assert(X, #X) + +void f(); +void f() noexcept(false); +void f() noexcept(1 == 0); +void f(); + +SA(!noexcept(f())); + +void g() throw (int); // { dg-error "previous declaration" } +void g() noexcept(false); // { dg-error "different exception" } +void g(); + +void h() throw(); +void h() noexcept; +void h() throw(); +void h() noexcept; + +template +void g (T) noexcept(noexcept(T())); // { dg-error "previous declaration" } +template +void g (T) noexcept(noexcept(T(0))); // { dg-error "different exception" } + +template +void f (T) noexcept(noexcept(T()) && noexcept(T())); +template +void f (T) noexcept(noexcept(T()) && noexcept(T())); +template +void f2(T a) noexcept (noexcept (f (a))); + +struct A { A(); }; +SA(noexcept(f(1))); +SA(!noexcept(f(A()))); +SA(noexcept(f2(1))); +SA(!noexcept(f2(A()))); + +template +void f3(Ts... ts) noexcept (noexcept (f(ts...))); + +SA(noexcept(f3(1))); +SA(!noexcept(f3(A()))); + +template +void f (T1, T2) noexcept(noexcept(T1(), T2())); + +struct B { }; + +SA(noexcept(f3(1,B()))); +SA(!noexcept(f3(1,A()))); +SA(!noexcept(f3(A(),1))); +SA(!noexcept(f3(A(),A()))); diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept03.C b/gcc/testsuite/g++.dg/cpp0x/noexcept03.C new file mode 100644 index 000000000..54e04f3d0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept03.C @@ -0,0 +1,51 @@ +// Runtime test for noexcept-specification. +// { dg-options "-std=c++0x -Wnoexcept" } +// { dg-do run } + +#include +#include + +void my_terminate () +{ + std::exit (0); +} + +void my_unexpected () +{ + throw; +} + +void g() { throw 1; } +void (*p)() = g; +void f () noexcept (false) +{ + p(); +} + +template +void f(T) noexcept (noexcept (T())) // { dg-warning "false" } +{ + p(); +} + +template +void f2(T a) noexcept (noexcept (f (a))) +{ + f(a); +} + +struct A { A() { } }; // { dg-warning "does not throw" } + +int main() +{ + // noexcept(false) allows throw. + try { f(); } catch (int) { } + // noexcept(noexcept(A())) == noexcept(false). + try { f(A()); } catch (int) { } + try { f2(A()); } catch (int) { } + + std::set_terminate (my_terminate); + // noexcept(noexcept(int())) == noexcept(true). + try { f2(1); } catch (...) { } + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept04.C b/gcc/testsuite/g++.dg/cpp0x/noexcept04.C new file mode 100644 index 000000000..8df818610 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept04.C @@ -0,0 +1,31 @@ +// Make sure that we call terminate when a noexcept spec is violated. +// The function pointers are there to make sure that +// the compiler doesn't get clever about optimizing the calls based on +// knowledge about the called functions. + +// { dg-options "-std=c++0x" } +// { dg-do run } + +#include +#include + +void my_terminate () +{ + std::exit (0); +} + +void g() { throw 1; } +void (*p1)() = g; +void f() noexcept { p1(); } +void (*p2)() = f; +void h() { p2(); } + +int main() +{ + std::set_terminate (my_terminate); + + try { h(); } + catch (int) { } + + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept05.C b/gcc/testsuite/g++.dg/cpp0x/noexcept05.C new file mode 100644 index 000000000..6acea4327 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept05.C @@ -0,0 +1,19 @@ +// Make sure that we force an LSDA for a noexcept spec so +// that the personality routine will call terminate. Also check that we +// optimize away the EH cleanup for var because the personality routine +// will call terminate before unwinding: there should not be an EH region +// (i.e. LEHB/LEHE labels) around the call to g(). + +// { dg-final { scan-assembler-not "_ZSt9terminatev" } } +// { dg-final { scan-assembler-not "EHB" } } +// { dg-final { scan-assembler "LSDA" } } + +// { dg-options "-std=c++0x" } + +struct A { ~A(); }; +void g(); +void f() noexcept +{ + A var; + g(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept06.C b/gcc/testsuite/g++.dg/cpp0x/noexcept06.C new file mode 100644 index 000000000..3babdffda --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept06.C @@ -0,0 +1,30 @@ +// Test that checking of a nothrow specification uses the one on the +// definition. +// { dg-options "-std=c++0x" } +// { dg-do run } + +#include +#include + +void my_unexpected () +{ + std::abort (); +} +void my_terminate () +{ + std::exit (0); +} + +void f() throw(); +void f() noexcept +{ + throw 1; +} + +int main() +{ + std::set_unexpected (my_unexpected); + std::set_terminate (my_terminate); + f(); + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept07.C b/gcc/testsuite/g++.dg/cpp0x/noexcept07.C new file mode 100644 index 000000000..0a5773fc8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept07.C @@ -0,0 +1,25 @@ +// Test that checking of a nothrow specification uses the one on the +// definition. +// { dg-options "-std=c++0x" } +// { dg-do run } + +#include +#include + +void my_unexpected () +{ + std::exit (0); +} + +void f() noexcept; +void f() throw() +{ + throw 1; +} + +int main() +{ + std::set_unexpected (my_unexpected); + f(); + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept08.C b/gcc/testsuite/g++.dg/cpp0x/noexcept08.C new file mode 100644 index 000000000..1df85efff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept08.C @@ -0,0 +1,56 @@ +// { dg-options "-std=c++0x" } +// { dg-prune-output "overriding" } + +struct A +{ + virtual void f(); + virtual void g() throw(); + virtual void h() noexcept; + virtual void i() noexcept(false); + virtual void j() throw(int); +}; + +struct B: A +{ + void f() noexcept; + void g() noexcept; + void h() noexcept; + void i() noexcept; + void j() noexcept; +}; + +struct C: A +{ + void f() throw(); + void g() throw(); + void h() throw(); + void i() throw(); + void j() throw(); +}; + +struct D: A +{ + void f() noexcept(false); + void g() noexcept(false); // { dg-error "looser" } + void h() noexcept(false); // { dg-error "looser" } + void i() noexcept(false); + void j() noexcept(false); // { dg-error "looser" } +}; + +struct E: A +{ + void f() throw(int); + void g() throw(int); // { dg-error "looser" } + void h() throw(int); // { dg-error "looser" } + void i() throw(int); + void j() throw(int); +}; + +struct F: A +{ + void f(); + void g(); // { dg-error "looser" } + void h(); // { dg-error "looser" } + void i(); + void j(); // { dg-error "looser" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept09.C b/gcc/testsuite/g++.dg/cpp0x/noexcept09.C new file mode 100644 index 000000000..2a4525cbd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept09.C @@ -0,0 +1,14 @@ +// Test that -Wnoexcept works with templates +// { dg-options "-std=c++0x -Wnoexcept" } + +template +T f (T t) { return t; } // { dg-warning "does not throw" } + +#define SA(X) static_assert(X, #X) + +SA (!noexcept(f(1))); // { dg-warning "noexcept" } + +int main() +{ + f(1); // Use f(int) so it gets instantiated +} diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept10.C b/gcc/testsuite/g++.dg/cpp0x/noexcept10.C new file mode 100644 index 000000000..058a387d7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept10.C @@ -0,0 +1,27 @@ +// PR c++/49082 +// { dg-options -std=c++0x } + +namespace std { template T&& declval() noexcept; } + +struct Base +{ + Base(const Base&) noexcept(false); + Base(Base&&) noexcept(false); + ~Base() noexcept(false); +}; + +struct Derived +: Base +{ + // Derived(const Derived&) = default; + // Derived(Derived&&) = default; +}; + +static_assert(!noexcept(Base(std::declval())), "Error"); +static_assert(!noexcept(Derived(std::declval())), "Error"); // Error + +static_assert(!noexcept(Base(std::declval())), "Error"); +static_assert(!noexcept(Derived(std::declval())), "Error"); // Error + +static_assert(!noexcept(std::declval().~Base()), "Error"); // OK +static_assert(!noexcept(std::declval().~Derived()), "Error"); // Error diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept11.C b/gcc/testsuite/g++.dg/cpp0x/noexcept11.C new file mode 100644 index 000000000..eba2c4080 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept11.C @@ -0,0 +1,4 @@ +// PR c++/50309 +// { dg-options -std=c++0x } + +void foo () noexcept () { } // { dg-error "expected" } diff --git a/gcc/testsuite/g++.dg/cpp0x/nolinkage1.C b/gcc/testsuite/g++.dg/cpp0x/nolinkage1.C new file mode 100644 index 000000000..b69b6ddc4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nolinkage1.C @@ -0,0 +1,22 @@ +// DR 757 allows using types without linkage in declarations with linkage. +// Test that this doesn't lead to link-time collisions. + +// { dg-additional-sources "nolinkage1a.cc" } +// { dg-do link } +// { dg-options -std=c++0x } + +#include "nolinkage1.h" + +typedef struct { int i; } *AP; + +void f(AP) { } + +A a; + +static void g() +{ + struct B { }; + A a; +} + +int main() { g(); f(0); } diff --git a/gcc/testsuite/g++.dg/cpp0x/nolinkage1.h b/gcc/testsuite/g++.dg/cpp0x/nolinkage1.h new file mode 100644 index 000000000..3cb5f63b3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nolinkage1.h @@ -0,0 +1,8 @@ +template +struct A +{ + A(); +}; + +template +A::A() { } diff --git a/gcc/testsuite/g++.dg/cpp0x/nolinkage1a.cc b/gcc/testsuite/g++.dg/cpp0x/nolinkage1a.cc new file mode 100644 index 000000000..f8528f3e6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nolinkage1a.cc @@ -0,0 +1,15 @@ +#include "nolinkage1.h" + +typedef struct { double d; } *BP; + +void f(BP) { } + +A b; + +static void g() +{ + struct B { }; + A a; +} + +int dummy() { g(); f(0); } diff --git a/gcc/testsuite/g++.dg/cpp0x/not_special.C b/gcc/testsuite/g++.dg/cpp0x/not_special.C new file mode 100644 index 000000000..6d73bd086 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/not_special.C @@ -0,0 +1,52 @@ +// I, Howard Hinnant, hereby place this code in the public domain. + +// Test that move constructor and move assignement are special. +// That is, their presence should inhibit compiler generated +// copy ctor or assignment. + +// { dg-options "-std=c++0x" } + +#include + +template struct sa; +template <> struct sa {}; + +struct one {char x[1];}; +struct two {char x[2];}; + +int copy = 0; +int assign = 0; + +struct base +{ + base() {} + base(const base&) {++copy;} + base& operator=(const base&) {++assign; return *this;} +}; + +struct derived + : base +{ + derived() {} + derived(derived&&) {} // { dg-error "argument 1" } + derived& operator=(derived&&) {return *this;} // { dg-error "argument 1" } +}; + +int test1() +{ + derived d; + derived d2(static_cast(d)); // should not call base::(const base&) + assert(copy == 0); + derived d3(d); // { dg-error "lvalue" } + assert(copy == 1); + d2 = static_cast(d); // should not call base::operator= + assert(assign == 0); + d3 = d; // { dg-error "lvalue" } + assert(assign == 1); + return 0; +} + +int main() +{ + return test1(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr01.C b/gcc/testsuite/g++.dg/cpp0x/nullptr01.C new file mode 100644 index 000000000..de3860c9e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr01.C @@ -0,0 +1,10 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test assignment to pointer + +char* const cp1 = nullptr; +char* const cp2 = __null; +char* const cp3 = 0; +decltype(nullptr) mynull = 0; +char* const cp4 = mynull; diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr02.C b/gcc/testsuite/g++.dg/cpp0x/nullptr02.C new file mode 100644 index 000000000..80977cb2f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr02.C @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test assignment to nullptr_t + +typedef decltype(nullptr) nullptr_t; + +const nullptr_t np1 = nullptr; +const nullptr_t np2 = __null; +const nullptr_t np3 = 0; +const nullptr_t np4 = np1; +const nullptr_t np5 = np2; +const nullptr_t np6 = np3; +const nullptr_t np7 = np4; +const nullptr_t np8 = np5; +const nullptr_t np9 = np6; diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr03.C b/gcc/testsuite/g++.dg/cpp0x/nullptr03.C new file mode 100644 index 000000000..b6df89637 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr03.C @@ -0,0 +1,9 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test assignment to int + +const int n1 = nullptr; // { dg-error "cannot convert " } +decltype(nullptr) mynull = 0; +const int n2 = mynull; // { dg-error "cannot convert " } + diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C new file mode 100644 index 000000000..be581bcb6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C @@ -0,0 +1,17 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test cast to int + +__extension__ typedef __INTPTR_TYPE__ intptr_t; + +const int n4 = static_cast(nullptr); // { dg-error "invalid static_cast " } +const short int n5 = reinterpret_cast(nullptr); // { dg-error "loses precision" } +const intptr_t n6 = reinterpret_cast(nullptr); +const intptr_t n7 = (intptr_t)nullptr; + +decltype(nullptr) mynull = 0; +const int n8 = static_cast(mynull); // { dg-error "invalid static_cast " } +const short int n9 = reinterpret_cast(mynull); // { dg-error "loses precision" } +const intptr_t n10 = reinterpret_cast(mynull); +const intptr_t n11 = (intptr_t)mynull; diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr05.C b/gcc/testsuite/g++.dg/cpp0x/nullptr05.C new file mode 100644 index 000000000..22a8b51c1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr05.C @@ -0,0 +1,14 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test assignment to method pointer + +class F { }; + +typedef void (F::*pmf)(); + +const pmf pmf1 = nullptr; +const pmf pmf2 = __null; +const pmf pmf3 = 0; +decltype(nullptr) mynull = 0; +const pmf pmf4 = mynull; diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr06.C b/gcc/testsuite/g++.dg/cpp0x/nullptr06.C new file mode 100644 index 000000000..c50bb9bc1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr06.C @@ -0,0 +1,15 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test compare to pointer + +#define assert_true(b) do { char c[2 * bool(b) - 1]; } while(0) + +char* const cp1 = nullptr; + +void fun() +{ + assert_true(cp1 == nullptr); + decltype(nullptr) mynull = 0; + assert_true(cp1 == mynull); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr07.C b/gcc/testsuite/g++.dg/cpp0x/nullptr07.C new file mode 100644 index 000000000..64d442be3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr07.C @@ -0,0 +1,15 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test compare to int + +void fun() +{ + int n = 0; + if( n == nullptr ); // { dg-error "invalid operands of types " } + const int m = 1; + if( m == nullptr ); // { dg-error "invalid operands of types " } + decltype(nullptr) mynull = 0; + if( n == mynull ); // { dg-error "invalid operands of types " } + if( m == mynull ); // { dg-error "invalid operands of types " } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr08.C b/gcc/testsuite/g++.dg/cpp0x/nullptr08.C new file mode 100644 index 000000000..1e5db278d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr08.C @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test conversion to bool + +#define assert_true(b) do { char c[2 * bool(b) - 1]; } while(0) + +void fun() +{ + assert_true(nullptr ? false : true); + decltype(nullptr) mynull = 0; + assert_true(mynull ? false : true); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr09.C b/gcc/testsuite/g++.dg/cpp0x/nullptr09.C new file mode 100644 index 000000000..b35a3c320 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr09.C @@ -0,0 +1,11 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test compare to literal 0 + +void fun() +{ + if( nullptr == 0 ); + decltype(nullptr) mynull = 0; + if( mynull == 0 ); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr10.C b/gcc/testsuite/g++.dg/cpp0x/nullptr10.C new file mode 100644 index 000000000..fa32267ec --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr10.C @@ -0,0 +1,14 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test arithmetic operations + +void fun() +{ + nullptr = 0; // { dg-error "lvalue required as left operand" } + nullptr + 2; // { dg-error "invalid operands of types " } + decltype(nullptr) mynull = 0; + mynull = 1; // { dg-error "cannot convert" } + mynull = 0; + mynull + 2; // { dg-error "invalid operands of types " } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr11.C b/gcc/testsuite/g++.dg/cpp0x/nullptr11.C new file mode 100644 index 000000000..5907816a8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr11.C @@ -0,0 +1,40 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test relational operators + +#define assert_true(b) do { char c[2 * bool(b) - 1]; } while(0) +#define assert_false(b) do { char c[1 - 2 * bool(b)]; } while(0) + +void fun() +{ + assert_true(nullptr == nullptr); + assert_false(nullptr != nullptr); + assert_false(nullptr < nullptr); + assert_false(nullptr > nullptr); + assert_true(nullptr <= nullptr); + assert_true(nullptr >= nullptr); + + decltype(nullptr) mynull = 0; + + assert_true(mynull == nullptr); + assert_false(mynull != nullptr); + assert_false(mynull < nullptr); + assert_false(mynull > nullptr); + assert_true(mynull <= nullptr); + assert_true(mynull >= nullptr); + + assert_true(nullptr == mynull); + assert_false(nullptr != mynull); + assert_false(nullptr < mynull); + assert_false(nullptr > mynull); + assert_true(nullptr <= mynull); + assert_true(nullptr >= mynull); + + assert_true(mynull == mynull); + assert_false(mynull != mynull); + assert_false(mynull < mynull); + assert_false(mynull > mynull); + assert_true(mynull <= mynull); + assert_true(mynull >= mynull); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr12.C b/gcc/testsuite/g++.dg/cpp0x/nullptr12.C new file mode 100644 index 000000000..1713259f1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr12.C @@ -0,0 +1,8 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test sizeof + +static_assert(sizeof(nullptr) == sizeof(void*), "sizeof(nullptr) is wrong"); +const decltype(nullptr) mynull = 0; +static_assert(sizeof(mynull) == sizeof(void*), "sizeof(nullptr) is wrong"); diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr13.C b/gcc/testsuite/g++.dg/cpp0x/nullptr13.C new file mode 100644 index 000000000..a9377584c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr13.C @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test typeid + +#include + +#define assert_true(b) do { char c[2 * bool(b) - 1]; } while(0) + +void fun() +{ + typeid(nullptr); + const decltype(nullptr) mynull = 0; + typeid(mynull); + assert_true(typeid(nullptr) == typeid(mynull)); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr14.C b/gcc/testsuite/g++.dg/cpp0x/nullptr14.C new file mode 100644 index 000000000..4c4627b54 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr14.C @@ -0,0 +1,25 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test overload preference char*/int + +template struct tType_equal; +template struct tType_equal { typedef void type; }; + +template +inline typename tType_equal::type +type_equal(U) { } + +char* f( char* ); +int f( int ); +long int f( long int ); + +void test_f() +{ + // Overloading cases + // + type_equal(f(nullptr)); + type_equal(f(0)); + decltype(nullptr) mynull = 0; + type_equal(f(mynull)); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr15.C b/gcc/testsuite/g++.dg/cpp0x/nullptr15.C new file mode 100644 index 000000000..e02fd5592 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr15.C @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test template deduction + +template struct tType_equal; +template struct tType_equal { typedef void type; }; + +template +inline typename tType_equal::type +type_equal(U) { } + +template T* g( T* t ); // { dg-message "note" } + +void test_g() +{ + // Deduction to nullptr_t, no deduction to pointer type + // + g(nullptr); // { dg-error "no matching function for call to " } + // { dg-message "candidate" "candidate note" { target *-*-* } 19 } + type_equal(g((float*)nullptr)); + decltype(nullptr) mynull = 0; + g(mynull); // { dg-error "no matching function for call to " } + // { dg-message "candidate" "candidate note" { target *-*-* } 23 } + type_equal(g((float*)mynull)); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr16.C b/gcc/testsuite/g++.dg/cpp0x/nullptr16.C new file mode 100644 index 000000000..0ec0b6a12 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr16.C @@ -0,0 +1,25 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test template deduction + +typedef decltype(nullptr) nullptr_t; + +template struct tType_equal; +template struct tType_equal { typedef void type; }; + +template +inline typename tType_equal::type +type_equal(U) { } + +template T h( T t ); + +void test_h() +{ + type_equal(h(0)); + type_equal(h(nullptr)); + type_equal(h((float*)nullptr)); + nullptr_t mynull = 0; + type_equal(h(mynull)); + type_equal(h((float*)mynull)); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr17.C b/gcc/testsuite/g++.dg/cpp0x/nullptr17.C new file mode 100644 index 000000000..2e580557b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr17.C @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test that bool is a better overload match than int + +template struct tType_equal; +template struct tType_equal { typedef void type; }; + +template +inline typename tType_equal::type +type_equal(U) { } + +int i( int ); +long int i( long int ); +bool i( bool ); + +void test_i() +{ + // Overload to bool, not int + type_equal(i(nullptr)); + decltype(nullptr) mynull = 0; + type_equal(i(mynull)); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr18.C b/gcc/testsuite/g++.dg/cpp0x/nullptr18.C new file mode 100644 index 000000000..b8fa38c71 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr18.C @@ -0,0 +1,21 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test overload of pointer versus bool when applied on a nullptr_t + +template struct tType_equal; +template struct tType_equal { typedef void type; }; + +template +inline typename tType_equal::type +type_equal(U) { } + +char* j( char* ); +bool j( bool ); + +void test_j() +{ + type_equal(j(nullptr)); + decltype(nullptr) mynull = 0; + type_equal(j(mynull)); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr19.C b/gcc/testsuite/g++.dg/cpp0x/nullptr19.C new file mode 100644 index 000000000..cf30f1c23 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr19.C @@ -0,0 +1,17 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +// Test overload of pointer versus nullptr_t when applied on a literal 0/__null + +typedef decltype(nullptr) nullptr_t; + +char* k( char* ); /* { dg-message "note" } { dg-message "note" } */ +nullptr_t k( nullptr_t ); /* { dg-message "note" } { dg-message "note" } */ + +void test_k() +{ + k(0); /* { dg-error "is ambiguous" } */ + // { dg-message "candidate" "candidate note" { target *-*-* } 13 } + k(__null); /* { dg-error "is ambiguous" } */ + // { dg-message "candidate" "candidate note" { target *-*-* } 15 } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr20.C b/gcc/testsuite/g++.dg/cpp0x/nullptr20.C new file mode 100644 index 000000000..3e5840677 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr20.C @@ -0,0 +1,20 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +// Test passing to ellipisis + +#include +#include + +int main() +{ + char buf1[64]; + char buf2[64]; + char buf3[64]; + + std::sprintf(buf1, "%p", (void*)0); + std::sprintf(buf2, "%p", nullptr); + decltype(nullptr) mynull = 0; + std::sprintf(buf3, "%p", nullptr); + return std::strcmp(buf1, buf2) != 0 || std::strcmp(buf1, buf3) != 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr21.C b/gcc/testsuite/g++.dg/cpp0x/nullptr21.C new file mode 100644 index 000000000..c30cb3c8b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr21.C @@ -0,0 +1,44 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +// Test throw and catch + +#include + +typedef decltype(nullptr) nullptr_t; + +int main() +{ + try { + throw nullptr; + } catch (void*) { + printf("Test 1 Fail"); + } catch (bool) { + printf("Test 1 Fail"); + } catch (int) { + printf("Test 1 Fail"); + } catch (long int) { + printf("Test 1 Fail"); + } catch (nullptr_t) { + printf("Test 1 OK"); + } catch (...) { + printf("Test 1 Fail"); + } // { dg-output "Test 1 OK" } + + nullptr_t mynull = 0; + try { + throw mynull; + } catch (void*) { + printf("Test 2 Fail"); + } catch (bool) { + printf("Test 2 Fail"); + } catch (int) { + printf("Test 2 Fail"); + } catch (long int) { + printf("Test 2 Fail"); + } catch (nullptr_t) { + printf("Test 2 OK"); + } catch (...) { + printf("Test 2 Fail"); + } // { dg-output "Test 2 OK" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr22.C b/gcc/testsuite/g++.dg/cpp0x/nullptr22.C new file mode 100644 index 000000000..d800f9869 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr22.C @@ -0,0 +1,20 @@ +// { dg-do compile } +// { dg-options "-std=c++0x -Wall -Wformat=2 -Wstrict-null-sentinel" } + +// Test various warnings + +void f1(const char*, ...) __attribute__((format(printf, 1, 2))); +void f2(const char*) __attribute__((nonnull)); +void f3(const char*, ...) __attribute__((sentinel)); + +void f() +{ + f1("%p", nullptr); + f2(nullptr); // { dg-warning "null argument where non-null required " } + f3("x", "y", __null); // { dg-warning "missing sentinel in function call" } + f3("x", "y", nullptr); + decltype(nullptr) mynull = 0; + f1("%p", mynull); + f2(mynull); // { dg-warning "null argument where non-null required " } + f3("x", "y", mynull); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr28.C b/gcc/testsuite/g++.dg/cpp0x/nullptr28.C new file mode 100644 index 000000000..4cc790d31 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr28.C @@ -0,0 +1,17 @@ +// { dg-do run } +// { dg-options "-std=c++0x -pedantic-errors" } + +typedef decltype(nullptr) nullptr_t; + +int i; +nullptr_t n; +const nullptr_t& f() { ++i; return n; } + +nullptr_t g() { return f(); } + +int main() +{ + g(); + if (i != 1) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/overload-conv-1.C b/gcc/testsuite/g++.dg/cpp0x/overload-conv-1.C new file mode 100644 index 000000000..778111283 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/overload-conv-1.C @@ -0,0 +1,29 @@ +// { dg-options "--std=c++0x" } +// { dg-do link } + +struct S {}; + +struct T +{ + operator S() { return S(); } +}; + +struct U +{ + operator S&() { return *static_cast(0); } +}; + +void f(const S&); +void f(S&&) {} + +void g(const S&) {} +void g(S&&); + +int main() +{ + T t; + f(t); + + U u; + g(u); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/overload-conv-2.C b/gcc/testsuite/g++.dg/cpp0x/overload-conv-2.C new file mode 100644 index 000000000..0e622bcac --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/overload-conv-2.C @@ -0,0 +1,17 @@ +// { dg-options "--std=c++0x" } +// { dg-do link } + +struct T {}; +struct S +{ + S(T const &) {} +}; + +void f(const S&); +void f(S&&) {} + +int main() +{ + T t; + f(t); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/overload.C b/gcc/testsuite/g++.dg/cpp0x/overload.C new file mode 100644 index 000000000..3782d4a20 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/overload.C @@ -0,0 +1,708 @@ +// { dg-options "--std=c++0x" } +// { dg-do link } +// Generated by overload.py + +template +inline _Tp&& +movel(_Tp& __t) +{ return static_cast<_Tp&&>(__t); } + +struct S{}; + +S l; // lvalue (l) +S const cl = l; // const lvalue (cl) +S r() { return l; } // rvalue (r) +S const cr() { return l; } // const rvalue (cr) +S & nl = l; // named lvalue reference (nl) +S const & ncl = l; // named const lvalue reference (ncl) +S && nr = movel(l); // named rvalue reference (nr) +S const && ncr = movel(l); // named const rvalue reference (ncr) +S & ul() { return l; } // unnamed lvalue reference (ul) +S const & ucl() { return l; } // unnamed const lvalue reference (ucl) +S && ur() { return movel(l); } // unnamed rvalue reference (ur) +S const && ucr() { return movel(l); } // unnamed const rvalue reference (ucr) + +void l0001(const S&&) {} + +void l0010(S&&) {} + +void l0011(S&&) {} +void l0011(const S&&); + +void l0100(const S&) {} + +void l0101(const S&) {} +void l0101(const S&&); + +void l0110(const S&) {} +void l0110(S&&); + +void l0111(const S&) {} +void l0111(S&&); +void l0111(const S&&); + +void l1000(S&) {} + +void l1001(S&) {} +void l1001(const S&&); + +void l1010(S&) {} +void l1010(S&&); + +void l1011(S&) {} +void l1011(S&&); +void l1011(const S&&); + +void l1100(S&) {} +void l1100(const S&); + +void l1101(S&) {} +void l1101(const S&); +void l1101(const S&&); + +void l1110(S&) {} +void l1110(const S&); +void l1110(S&&); + +void l1111(S&) {} +void l1111(const S&); +void l1111(S&&); +void l1111(const S&&); + +void cl0001(const S&&) {} + +void cl0011(S&&); +void cl0011(const S&&) {} + +void cl0100(const S&) {} + +void cl0101(const S&) {} +void cl0101(const S&&); + +void cl0110(const S&) {} +void cl0110(S&&); + +void cl0111(const S&) {} +void cl0111(S&&); +void cl0111(const S&&); + +void cl1001(S&); +void cl1001(const S&&) {} + +void cl1011(S&); +void cl1011(S&&); +void cl1011(const S&&) {} + +void cl1100(S&); +void cl1100(const S&) {} + +void cl1101(S&); +void cl1101(const S&) {} +void cl1101(const S&&); + +void cl1110(S&); +void cl1110(const S&) {} +void cl1110(S&&); + +void cl1111(S&); +void cl1111(const S&) {} +void cl1111(S&&); +void cl1111(const S&&); + +void r0001(const S&&) {} + +void r0010(S&&) {} + +void r0011(S&&) {} +void r0011(const S&&); + +void r0100(const S&) {} + +void r0101(const S&); +void r0101(const S&&) {} + +void r0110(const S&); +void r0110(S&&) {} + +void r0111(const S&); +void r0111(S&&) {} +void r0111(const S&&); + +void r1001(S&); +void r1001(const S&&) {} + +void r1010(S&); +void r1010(S&&) {} + +void r1011(S&); +void r1011(S&&) {} +void r1011(const S&&); + +void r1100(S&); +void r1100(const S&) {} + +void r1101(S&); +void r1101(const S&); +void r1101(const S&&) {} + +void r1110(S&); +void r1110(const S&); +void r1110(S&&) {} + +void r1111(S&); +void r1111(const S&); +void r1111(S&&) {} +void r1111(const S&&); + +void cr0001(const S&&) {} + +void cr0011(S&&); +void cr0011(const S&&) {} + +void cr0100(const S&) {} + +void cr0101(const S&); +void cr0101(const S&&) {} + +void cr0110(const S&) {} +void cr0110(S&&); + +void cr0111(const S&); +void cr0111(S&&); +void cr0111(const S&&) {} + +void cr1001(S&); +void cr1001(const S&&) {} + +void cr1011(S&); +void cr1011(S&&); +void cr1011(const S&&) {} + +void cr1100(S&); +void cr1100(const S&) {} + +void cr1101(S&); +void cr1101(const S&); +void cr1101(const S&&) {} + +void cr1110(S&); +void cr1110(const S&) {} +void cr1110(S&&); + +void cr1111(S&); +void cr1111(const S&); +void cr1111(S&&); +void cr1111(const S&&) {} + +void nl0001(const S&&) {} + +void nl0010(S&&) {} + +void nl0011(S&&) {} +void nl0011(const S&&); + +void nl0100(const S&) {} + +void nl0101(const S&) {} +void nl0101(const S&&); + +void nl0110(const S&) {} +void nl0110(S&&); + +void nl0111(const S&) {} +void nl0111(S&&); +void nl0111(const S&&); + +void nl1000(S&) {} + +void nl1001(S&) {} +void nl1001(const S&&); + +void nl1010(S&) {} +void nl1010(S&&); + +void nl1011(S&) {} +void nl1011(S&&); +void nl1011(const S&&); + +void nl1100(S&) {} +void nl1100(const S&); + +void nl1101(S&) {} +void nl1101(const S&); +void nl1101(const S&&); + +void nl1110(S&) {} +void nl1110(const S&); +void nl1110(S&&); + +void nl1111(S&) {} +void nl1111(const S&); +void nl1111(S&&); +void nl1111(const S&&); + +void ncl0001(const S&&) {} + +void ncl0011(S&&); +void ncl0011(const S&&) {} + +void ncl0100(const S&) {} + +void ncl0101(const S&) {} +void ncl0101(const S&&); + +void ncl0110(const S&) {} +void ncl0110(S&&); + +void ncl0111(const S&) {} +void ncl0111(S&&); +void ncl0111(const S&&); + +void ncl1001(S&); +void ncl1001(const S&&) {} + +void ncl1011(S&); +void ncl1011(S&&); +void ncl1011(const S&&) {} + +void ncl1100(S&); +void ncl1100(const S&) {} + +void ncl1101(S&); +void ncl1101(const S&) {} +void ncl1101(const S&&); + +void ncl1110(S&); +void ncl1110(const S&) {} +void ncl1110(S&&); + +void ncl1111(S&); +void ncl1111(const S&) {} +void ncl1111(S&&); +void ncl1111(const S&&); + +void nr0001(const S&&) {} + +void nr0010(S&&) {} + +void nr0011(S&&) {} +void nr0011(const S&&); + +void nr0100(const S&) {} + +void nr0101(const S&) {} +void nr0101(const S&&); + +void nr0110(const S&) {} +void nr0110(S&&); + +void nr0111(const S&) {} +void nr0111(S&&); +void nr0111(const S&&); + +void nr1000(S&) {} + +void nr1001(S&) {} +void nr1001(const S&&); + +void nr1010(S&) {} +void nr1010(S&&); + +void nr1011(S&) {} +void nr1011(S&&); +void nr1011(const S&&); + +void nr1100(S&) {} +void nr1100(const S&); + +void nr1101(S&) {} +void nr1101(const S&); +void nr1101(const S&&); + +void nr1110(S&) {} +void nr1110(const S&); +void nr1110(S&&); + +void nr1111(S&) {} +void nr1111(const S&); +void nr1111(S&&); +void nr1111(const S&&); + +void ncr0001(const S&&) {} + +void ncr0011(S&&); +void ncr0011(const S&&) {} + +void ncr0100(const S&) {} + +void ncr0101(const S&) {} +void ncr0101(const S&&); + +void ncr0110(const S&) {} +void ncr0110(S&&); + +void ncr0111(const S&) {} +void ncr0111(S&&); +void ncr0111(const S&&); + +void ncr1001(S&); +void ncr1001(const S&&) {} + +void ncr1011(S&); +void ncr1011(S&&); +void ncr1011(const S&&) {} + +void ncr1100(S&); +void ncr1100(const S&) {} + +void ncr1101(S&); +void ncr1101(const S&) {} +void ncr1101(const S&&); + +void ncr1110(S&); +void ncr1110(const S&) {} +void ncr1110(S&&); + +void ncr1111(S&); +void ncr1111(const S&) {} +void ncr1111(S&&); +void ncr1111(const S&&); + +void ul0001(const S&&) {} + +void ul0010(S&&) {} + +void ul0011(S&&) {} +void ul0011(const S&&); + +void ul0100(const S&) {} + +void ul0101(const S&) {} +void ul0101(const S&&); + +void ul0110(const S&) {} +void ul0110(S&&); + +void ul0111(const S&) {} +void ul0111(S&&); +void ul0111(const S&&); + +void ul1000(S&) {} + +void ul1001(S&) {} +void ul1001(const S&&); + +void ul1010(S&) {} +void ul1010(S&&); + +void ul1011(S&) {} +void ul1011(S&&); +void ul1011(const S&&); + +void ul1100(S&) {} +void ul1100(const S&); + +void ul1101(S&) {} +void ul1101(const S&); +void ul1101(const S&&); + +void ul1110(S&) {} +void ul1110(const S&); +void ul1110(S&&); + +void ul1111(S&) {} +void ul1111(const S&); +void ul1111(S&&); +void ul1111(const S&&); + +void ucl0001(const S&&) {} + +void ucl0011(S&&); +void ucl0011(const S&&) {} + +void ucl0100(const S&) {} + +void ucl0101(const S&) {} +void ucl0101(const S&&); + +void ucl0110(const S&) {} +void ucl0110(S&&); + +void ucl0111(const S&) {} +void ucl0111(S&&); +void ucl0111(const S&&); + +void ucl1001(S&); +void ucl1001(const S&&) {} + +void ucl1011(S&); +void ucl1011(S&&); +void ucl1011(const S&&) {} + +void ucl1100(S&); +void ucl1100(const S&) {} + +void ucl1101(S&); +void ucl1101(const S&) {} +void ucl1101(const S&&); + +void ucl1110(S&); +void ucl1110(const S&) {} +void ucl1110(S&&); + +void ucl1111(S&); +void ucl1111(const S&) {} +void ucl1111(S&&); +void ucl1111(const S&&); + +void ur0001(const S&&) {} + +void ur0010(S&&) {} + +void ur0011(S&&) {} +void ur0011(const S&&); + +void ur0100(const S&) {} + +void ur0101(const S&); +void ur0101(const S&&) {} + +void ur0110(const S&); +void ur0110(S&&) {} + +void ur0111(const S&); +void ur0111(S&&) {} +void ur0111(const S&&); + +void ur1001(S&); +void ur1001(const S&&) {} + +void ur1010(S&); +void ur1010(S&&) {} + +void ur1011(S&); +void ur1011(S&&) {} +void ur1011(const S&&); + +void ur1100(S&); +void ur1100(const S&) {} + +void ur1101(S&); +void ur1101(const S&); +void ur1101(const S&&) {} + +void ur1110(S&); +void ur1110(const S&); +void ur1110(S&&) {} + +void ur1111(S&); +void ur1111(const S&); +void ur1111(S&&) {} +void ur1111(const S&&); + +void ucr0001(const S&&) {} + +void ucr0011(S&&); +void ucr0011(const S&&) {} + +void ucr0100(const S&) {} + +void ucr0101(const S&); +void ucr0101(const S&&) {} + +void ucr0110(const S&) {} +void ucr0110(S&&); + +void ucr0111(const S&); +void ucr0111(S&&); +void ucr0111(const S&&) {} + +void ucr1001(S&); +void ucr1001(const S&&) {} + +void ucr1011(S&); +void ucr1011(S&&); +void ucr1011(const S&&) {} + +void ucr1100(S&); +void ucr1100(const S&) {} + +void ucr1101(S&); +void ucr1101(const S&); +void ucr1101(const S&&) {} + +void ucr1110(S&); +void ucr1110(const S&) {} +void ucr1110(S&&); + +void ucr1111(S&); +void ucr1111(const S&); +void ucr1111(S&&); +void ucr1111(const S&&) {} + + +int main() +{ + //l0001(l); + //l0010(l); + //l0011(l); + l0100(l); + l0101(l); + l0110(l); + l0111(l); + l1000(l); + l1001(l); + l1010(l); + l1011(l); + l1100(l); + l1101(l); + l1110(l); + l1111(l); + //cl0001(cl); + //cl0011(cl); + cl0100(cl); + cl0101(cl); + cl0110(cl); + cl0111(cl); + //cl1001(cl); + //cl1011(cl); + cl1100(cl); + cl1101(cl); + cl1110(cl); + cl1111(cl); + r0001(r()); + r0010(r()); + r0011(r()); + r0100(r()); + r0101(r()); + r0110(r()); + r0111(r()); + r1001(r()); + r1010(r()); + r1011(r()); + r1100(r()); + r1101(r()); + r1110(r()); + r1111(r()); + cr0001(cr()); + cr0011(cr()); + cr0100(cr()); + cr0101(cr()); + cr0110(cr()); + cr0111(cr()); + cr1001(cr()); + cr1011(cr()); + cr1100(cr()); + cr1101(cr()); + cr1110(cr()); + cr1111(cr()); + //nl0001(nl); + //nl0010(nl); + //nl0011(nl); + nl0100(nl); + nl0101(nl); + nl0110(nl); + nl0111(nl); + nl1000(nl); + nl1001(nl); + nl1010(nl); + nl1011(nl); + nl1100(nl); + nl1101(nl); + nl1110(nl); + nl1111(nl); + //ncl0001(ncl); + //ncl0011(ncl); + ncl0100(ncl); + ncl0101(ncl); + ncl0110(ncl); + ncl0111(ncl); + //ncl1001(ncl); + //ncl1011(ncl); + ncl1100(ncl); + ncl1101(ncl); + ncl1110(ncl); + ncl1111(ncl); + //nr0001(nr); + //nr0010(nr); + //nr0011(nr); + nr0100(nr); + nr0101(nr); + nr0110(nr); + nr0111(nr); + nr1000(nr); + nr1001(nr); + nr1010(nr); + nr1011(nr); + nr1100(nr); + nr1101(nr); + nr1110(nr); + nr1111(nr); + //ncr0001(ncr); + //ncr0011(ncr); + ncr0100(ncr); + ncr0101(ncr); + ncr0110(ncr); + ncr0111(ncr); + //ncr1001(ncr); + //ncr1011(ncr); + ncr1100(ncr); + ncr1101(ncr); + ncr1110(ncr); + ncr1111(ncr); + //ul0001(ul()); + //ul0010(ul()); + //ul0011(ul()); + ul0100(ul()); + ul0101(ul()); + ul0110(ul()); + ul0111(ul()); + ul1000(ul()); + ul1001(ul()); + ul1010(ul()); + ul1011(ul()); + ul1100(ul()); + ul1101(ul()); + ul1110(ul()); + ul1111(ul()); + //ucl0001(ucl()); + //ucl0011(ucl()); + ucl0100(ucl()); + ucl0101(ucl()); + ucl0110(ucl()); + ucl0111(ucl()); + //ucl1001(ucl()); + //ucl1011(ucl()); + ucl1100(ucl()); + ucl1101(ucl()); + ucl1110(ucl()); + ucl1111(ucl()); + ur0001(ur()); + ur0010(ur()); + ur0011(ur()); + ur0100(ur()); + ur0101(ur()); + ur0110(ur()); + ur0111(ur()); + ur1001(ur()); + ur1010(ur()); + ur1011(ur()); + ur1100(ur()); + ur1101(ur()); + ur1110(ur()); + ur1111(ur()); + ucr0001(ucr()); + ucr0011(ucr()); + ucr0100(ucr()); + ucr0101(ucr()); + ucr0110(ucr()); + ucr0111(ucr()); + ucr1001(ucr()); + ucr1011(ucr()); + ucr1100(ucr()); + ucr1101(ucr()); + ucr1110(ucr()); + ucr1111(ucr()); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/overloadn.C b/gcc/testsuite/g++.dg/cpp0x/overloadn.C new file mode 100644 index 000000000..a42707fe4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/overloadn.C @@ -0,0 +1,708 @@ +// { dg-options "--std=c++0x" } +// { dg-do link } +// Generated by overload.py + +template +inline _Tp&& +movel(_Tp& __t) +{ return static_cast<_Tp&&>(__t); } + +struct S{}; + +S l; // lvalue (l) +S const cl = l; // const lvalue (cl) +S r() { return l; } // rvalue (r) +S const cr() { return l; } // const rvalue (cr) +S & nl = l; // named lvalue reference (nl) +S const & ncl = l; // named const lvalue reference (ncl) +S && nr = movel(l); // named rvalue reference (nr) +S const && ncr = movel(l); // named const rvalue reference (ncr) +S & ul() { return l; } // unnamed lvalue reference (ul) +S const & ucl() { return l; } // unnamed const lvalue reference (ucl) +S && ur() { return movel(l); } // unnamed rvalue reference (ur) +S const && ucr() { return movel(l); } // unnamed const rvalue reference (ucr) + +void l0001(const S&&) {} // { dg-message "" } + +void l0010(S&&) {} // { dg-message "" } + +void l0011(S&&) {} // { dg-message "" } +void l0011(const S&&); + +void l0100(const S&) {} + +void l0101(const S&) {} +void l0101(const S&&); + +void l0110(const S&) {} +void l0110(S&&); + +void l0111(const S&) {} +void l0111(S&&); +void l0111(const S&&); + +void l1000(S&) {} + +void l1001(S&) {} +void l1001(const S&&); + +void l1010(S&) {} +void l1010(S&&); + +void l1011(S&) {} +void l1011(S&&); +void l1011(const S&&); + +void l1100(S&) {} +void l1100(const S&); + +void l1101(S&) {} +void l1101(const S&); +void l1101(const S&&); + +void l1110(S&) {} +void l1110(const S&); +void l1110(S&&); + +void l1111(S&) {} +void l1111(const S&); +void l1111(S&&); +void l1111(const S&&); + +void cl0001(const S&&) {} // { dg-message "" } + +void cl0011(S&&); +void cl0011(const S&&) {} // { dg-message "" } + +void cl0100(const S&) {} + +void cl0101(const S&) {} +void cl0101(const S&&); + +void cl0110(const S&) {} +void cl0110(S&&); + +void cl0111(const S&) {} +void cl0111(S&&); +void cl0111(const S&&); + +void cl1001(S&); +void cl1001(const S&&) {} // { dg-message "" } + +void cl1011(S&); +void cl1011(S&&); +void cl1011(const S&&) {} // { dg-message "" } + +void cl1100(S&); +void cl1100(const S&) {} + +void cl1101(S&); +void cl1101(const S&) {} +void cl1101(const S&&); + +void cl1110(S&); +void cl1110(const S&) {} +void cl1110(S&&); + +void cl1111(S&); +void cl1111(const S&) {} +void cl1111(S&&); +void cl1111(const S&&); + +void r0001(const S&&) {} + +void r0010(S&&) {} + +void r0011(S&&) {} +void r0011(const S&&); + +void r0100(const S&) {} + +void r0101(const S&); +void r0101(const S&&) {} + +void r0110(const S&); +void r0110(S&&) {} + +void r0111(const S&); +void r0111(S&&) {} +void r0111(const S&&); + +void r1001(S&); +void r1001(const S&&) {} + +void r1010(S&); +void r1010(S&&) {} + +void r1011(S&); +void r1011(S&&) {} +void r1011(const S&&); + +void r1100(S&); +void r1100(const S&) {} + +void r1101(S&); +void r1101(const S&); +void r1101(const S&&) {} + +void r1110(S&); +void r1110(const S&); +void r1110(S&&) {} + +void r1111(S&); +void r1111(const S&); +void r1111(S&&) {} +void r1111(const S&&); + +void cr0001(const S&&) {} + +void cr0011(S&&); +void cr0011(const S&&) {} + +void cr0100(const S&) {} + +void cr0101(const S&); +void cr0101(const S&&) {} + +void cr0110(const S&) {} +void cr0110(S&&); + +void cr0111(const S&); +void cr0111(S&&); +void cr0111(const S&&) {} + +void cr1001(S&); +void cr1001(const S&&) {} + +void cr1011(S&); +void cr1011(S&&); +void cr1011(const S&&) {} + +void cr1100(S&); +void cr1100(const S&) {} + +void cr1101(S&); +void cr1101(const S&); +void cr1101(const S&&) {} + +void cr1110(S&); +void cr1110(const S&) {} +void cr1110(S&&); + +void cr1111(S&); +void cr1111(const S&); +void cr1111(S&&); +void cr1111(const S&&) {} + +void nl0001(const S&&) {} // { dg-message "" } + +void nl0010(S&&) {} // { dg-message "" } + +void nl0011(S&&) {} // { dg-message "" } +void nl0011(const S&&); + +void nl0100(const S&) {} + +void nl0101(const S&) {} +void nl0101(const S&&); + +void nl0110(const S&) {} +void nl0110(S&&); + +void nl0111(const S&) {} +void nl0111(S&&); +void nl0111(const S&&); + +void nl1000(S&) {} + +void nl1001(S&) {} +void nl1001(const S&&); + +void nl1010(S&) {} +void nl1010(S&&); + +void nl1011(S&) {} +void nl1011(S&&); +void nl1011(const S&&); + +void nl1100(S&) {} +void nl1100(const S&); + +void nl1101(S&) {} +void nl1101(const S&); +void nl1101(const S&&); + +void nl1110(S&) {} +void nl1110(const S&); +void nl1110(S&&); + +void nl1111(S&) {} +void nl1111(const S&); +void nl1111(S&&); +void nl1111(const S&&); + +void ncl0001(const S&&) {} // { dg-message "" } + +void ncl0011(S&&); +void ncl0011(const S&&) {} // { dg-message "" } + +void ncl0100(const S&) {} + +void ncl0101(const S&) {} +void ncl0101(const S&&); + +void ncl0110(const S&) {} +void ncl0110(S&&); + +void ncl0111(const S&) {} +void ncl0111(S&&); +void ncl0111(const S&&); + +void ncl1001(S&); +void ncl1001(const S&&) {} // { dg-message "" } + +void ncl1011(S&); +void ncl1011(S&&); +void ncl1011(const S&&) {} // { dg-message "" } + +void ncl1100(S&); +void ncl1100(const S&) {} + +void ncl1101(S&); +void ncl1101(const S&) {} +void ncl1101(const S&&); + +void ncl1110(S&); +void ncl1110(const S&) {} +void ncl1110(S&&); + +void ncl1111(S&); +void ncl1111(const S&) {} +void ncl1111(S&&); +void ncl1111(const S&&); + +void nr0001(const S&&) {} // { dg-message "" } + +void nr0010(S&&) {} // { dg-message "" } + +void nr0011(S&&) {} // { dg-message "" } +void nr0011(const S&&); + +void nr0100(const S&) {} + +void nr0101(const S&) {} +void nr0101(const S&&); + +void nr0110(const S&) {} +void nr0110(S&&); + +void nr0111(const S&) {} +void nr0111(S&&); +void nr0111(const S&&); + +void nr1000(S&) {} + +void nr1001(S&) {} +void nr1001(const S&&); + +void nr1010(S&) {} +void nr1010(S&&); + +void nr1011(S&) {} +void nr1011(S&&); +void nr1011(const S&&); + +void nr1100(S&) {} +void nr1100(const S&); + +void nr1101(S&) {} +void nr1101(const S&); +void nr1101(const S&&); + +void nr1110(S&) {} +void nr1110(const S&); +void nr1110(S&&); + +void nr1111(S&) {} +void nr1111(const S&); +void nr1111(S&&); +void nr1111(const S&&); + +void ncr0001(const S&&) {} // { dg-message "" } + +void ncr0011(S&&); +void ncr0011(const S&&) {} // { dg-message "" } + +void ncr0100(const S&) {} + +void ncr0101(const S&) {} +void ncr0101(const S&&); + +void ncr0110(const S&) {} +void ncr0110(S&&); + +void ncr0111(const S&) {} +void ncr0111(S&&); +void ncr0111(const S&&); + +void ncr1001(S&); +void ncr1001(const S&&) {} // { dg-message "" } + +void ncr1011(S&); +void ncr1011(S&&); +void ncr1011(const S&&) {} // { dg-message "" } + +void ncr1100(S&); +void ncr1100(const S&) {} + +void ncr1101(S&); +void ncr1101(const S&) {} +void ncr1101(const S&&); + +void ncr1110(S&); +void ncr1110(const S&) {} +void ncr1110(S&&); + +void ncr1111(S&); +void ncr1111(const S&) {} +void ncr1111(S&&); +void ncr1111(const S&&); + +void ul0001(const S&&) {} // { dg-message "" } + +void ul0010(S&&) {} // { dg-message "" } + +void ul0011(S&&) {} // { dg-message "" } +void ul0011(const S&&); + +void ul0100(const S&) {} + +void ul0101(const S&) {} +void ul0101(const S&&); + +void ul0110(const S&) {} +void ul0110(S&&); + +void ul0111(const S&) {} +void ul0111(S&&); +void ul0111(const S&&); + +void ul1000(S&) {} + +void ul1001(S&) {} +void ul1001(const S&&); + +void ul1010(S&) {} +void ul1010(S&&); + +void ul1011(S&) {} +void ul1011(S&&); +void ul1011(const S&&); + +void ul1100(S&) {} +void ul1100(const S&); + +void ul1101(S&) {} +void ul1101(const S&); +void ul1101(const S&&); + +void ul1110(S&) {} +void ul1110(const S&); +void ul1110(S&&); + +void ul1111(S&) {} +void ul1111(const S&); +void ul1111(S&&); +void ul1111(const S&&); + +void ucl0001(const S&&) {} // { dg-message "" } + +void ucl0011(S&&); +void ucl0011(const S&&) {} // { dg-message "" } + +void ucl0100(const S&) {} + +void ucl0101(const S&) {} +void ucl0101(const S&&); + +void ucl0110(const S&) {} +void ucl0110(S&&); + +void ucl0111(const S&) {} +void ucl0111(S&&); +void ucl0111(const S&&); + +void ucl1001(S&); +void ucl1001(const S&&) {} // { dg-message "" } + +void ucl1011(S&); +void ucl1011(S&&); +void ucl1011(const S&&) {} // { dg-message "" } + +void ucl1100(S&); +void ucl1100(const S&) {} + +void ucl1101(S&); +void ucl1101(const S&) {} +void ucl1101(const S&&); + +void ucl1110(S&); +void ucl1110(const S&) {} +void ucl1110(S&&); + +void ucl1111(S&); +void ucl1111(const S&) {} +void ucl1111(S&&); +void ucl1111(const S&&); + +void ur0001(const S&&) {} + +void ur0010(S&&) {} + +void ur0011(S&&) {} +void ur0011(const S&&); + +void ur0100(const S&) {} + +void ur0101(const S&); +void ur0101(const S&&) {} + +void ur0110(const S&); +void ur0110(S&&) {} + +void ur0111(const S&); +void ur0111(S&&) {} +void ur0111(const S&&); + +void ur1001(S&); +void ur1001(const S&&) {} + +void ur1010(S&); +void ur1010(S&&) {} + +void ur1011(S&); +void ur1011(S&&) {} +void ur1011(const S&&); + +void ur1100(S&); +void ur1100(const S&) {} + +void ur1101(S&); +void ur1101(const S&); +void ur1101(const S&&) {} + +void ur1110(S&); +void ur1110(const S&); +void ur1110(S&&) {} + +void ur1111(S&); +void ur1111(const S&); +void ur1111(S&&) {} +void ur1111(const S&&); + +void ucr0001(const S&&) {} + +void ucr0011(S&&); +void ucr0011(const S&&) {} + +void ucr0100(const S&) {} + +void ucr0101(const S&); +void ucr0101(const S&&) {} + +void ucr0110(const S&) {} +void ucr0110(S&&); + +void ucr0111(const S&); +void ucr0111(S&&); +void ucr0111(const S&&) {} + +void ucr1001(S&); +void ucr1001(const S&&) {} + +void ucr1011(S&); +void ucr1011(S&&); +void ucr1011(const S&&) {} + +void ucr1100(S&); +void ucr1100(const S&) {} + +void ucr1101(S&); +void ucr1101(const S&); +void ucr1101(const S&&) {} + +void ucr1110(S&); +void ucr1110(const S&) {} +void ucr1110(S&&); + +void ucr1111(S&); +void ucr1111(const S&); +void ucr1111(S&&); +void ucr1111(const S&&) {} + + +int main() +{ + l0001(l); // { dg-error "lvalue" } + l0010(l); // { dg-error "lvalue" } + l0011(l); // { dg-error "lvalue" } + l0100(l); + l0101(l); + l0110(l); + l0111(l); + l1000(l); + l1001(l); + l1010(l); + l1011(l); + l1100(l); + l1101(l); + l1110(l); + l1111(l); + cl0001(cl); // { dg-error "lvalue" } + cl0011(cl); // { dg-error "lvalue" } + cl0100(cl); + cl0101(cl); + cl0110(cl); + cl0111(cl); + cl1001(cl); // { dg-error "lvalue" } + cl1011(cl); // { dg-error "lvalue" } + cl1100(cl); + cl1101(cl); + cl1110(cl); + cl1111(cl); + r0001(r()); + r0010(r()); + r0011(r()); + r0100(r()); + r0101(r()); + r0110(r()); + r0111(r()); + r1001(r()); + r1010(r()); + r1011(r()); + r1100(r()); + r1101(r()); + r1110(r()); + r1111(r()); + cr0001(cr()); + cr0011(cr()); + cr0100(cr()); + cr0101(cr()); + cr0110(cr()); + cr0111(cr()); + cr1001(cr()); + cr1011(cr()); + cr1100(cr()); + cr1101(cr()); + cr1110(cr()); + cr1111(cr()); + nl0001(nl); // { dg-error "lvalue" } + nl0010(nl); // { dg-error "lvalue" } + nl0011(nl); // { dg-error "lvalue" } + nl0100(nl); + nl0101(nl); + nl0110(nl); + nl0111(nl); + nl1000(nl); + nl1001(nl); + nl1010(nl); + nl1011(nl); + nl1100(nl); + nl1101(nl); + nl1110(nl); + nl1111(nl); + ncl0001(ncl); // { dg-error "lvalue" } + ncl0011(ncl); // { dg-error "lvalue" } + ncl0100(ncl); + ncl0101(ncl); + ncl0110(ncl); + ncl0111(ncl); + ncl1001(ncl); // { dg-error "lvalue" } + ncl1011(ncl); // { dg-error "lvalue" } + ncl1100(ncl); + ncl1101(ncl); + ncl1110(ncl); + ncl1111(ncl); + nr0001(nr); // { dg-error "lvalue" } + nr0010(nr); // { dg-error "lvalue" } + nr0011(nr); // { dg-error "lvalue" } + nr0100(nr); + nr0101(nr); + nr0110(nr); + nr0111(nr); + nr1000(nr); + nr1001(nr); + nr1010(nr); + nr1011(nr); + nr1100(nr); + nr1101(nr); + nr1110(nr); + nr1111(nr); + ncr0001(ncr); // { dg-error "lvalue" } + ncr0011(ncr); // { dg-error "lvalue" } + ncr0100(ncr); + ncr0101(ncr); + ncr0110(ncr); + ncr0111(ncr); + ncr1001(ncr); // { dg-error "lvalue" } + ncr1011(ncr); // { dg-error "lvalue" } + ncr1100(ncr); + ncr1101(ncr); + ncr1110(ncr); + ncr1111(ncr); + ul0001(ul()); // { dg-error "lvalue" } + ul0010(ul()); // { dg-error "lvalue" } + ul0011(ul()); // { dg-error "lvalue" } + ul0100(ul()); + ul0101(ul()); + ul0110(ul()); + ul0111(ul()); + ul1000(ul()); + ul1001(ul()); + ul1010(ul()); + ul1011(ul()); + ul1100(ul()); + ul1101(ul()); + ul1110(ul()); + ul1111(ul()); + ucl0001(ucl()); // { dg-error "lvalue" } + ucl0011(ucl()); // { dg-error "lvalue" } + ucl0100(ucl()); + ucl0101(ucl()); + ucl0110(ucl()); + ucl0111(ucl()); + ucl1001(ucl()); // { dg-error "lvalue" } + ucl1011(ucl()); // { dg-error "lvalue" } + ucl1100(ucl()); + ucl1101(ucl()); + ucl1110(ucl()); + ucl1111(ucl()); + ur0001(ur()); + ur0010(ur()); + ur0011(ur()); + ur0100(ur()); + ur0101(ur()); + ur0110(ur()); + ur0111(ur()); + ur1001(ur()); + ur1010(ur()); + ur1011(ur()); + ur1100(ur()); + ur1101(ur()); + ur1110(ur()); + ur1111(ur()); + ucr0001(ucr()); + ucr0011(ucr()); + ucr0100(ucr()); + ucr0101(ucr()); + ucr0110(ucr()); + ucr0111(ucr()); + ucr1001(ucr()); + ucr1011(ucr()); + ucr1100(ucr()); + ucr1101(ucr()); + ucr1110(ucr()); + ucr1111(ucr()); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/parse1.C b/gcc/testsuite/g++.dg/cpp0x/parse1.C new file mode 100644 index 000000000..41811853c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/parse1.C @@ -0,0 +1,5 @@ +// PR c++/43509 +// { dg-options "-std=c++0x" } + +typedef int B; // { dg-error "" } +B::B() {} // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31431-2.C b/gcc/testsuite/g++.dg/cpp0x/pr31431-2.C new file mode 100644 index 000000000..15efbc5d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr31431-2.C @@ -0,0 +1,8 @@ +// { dg-options "-std=gnu++0x" } +template void foo(); // { dg-message "note" } + +void bar() +{ + foo(); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 6 } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31431.C b/gcc/testsuite/g++.dg/cpp0x/pr31431.C new file mode 100644 index 000000000..36f341f3d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr31431.C @@ -0,0 +1,8 @@ +// { dg-options "-std=gnu++0x" } +template void foo(); // { dg-message "note" } + +void bar() +{ + foo(); // { dg-error "no matching function" } + // { dg-message "candidate" "candidate note" { target *-*-* } 6 } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31432.C b/gcc/testsuite/g++.dg/cpp0x/pr31432.C new file mode 100644 index 000000000..8016ee69d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr31432.C @@ -0,0 +1,8 @@ +// { dg-options "-std=gnu++0x" } +template struct A // { dg-error "parameter pack" } +{ + static int i; +}; + +A a; // { dg-error "mismatch|expected|invalid type" } +A b; // { dg-error "mismatch|expected|invalid type" } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31434.C b/gcc/testsuite/g++.dg/cpp0x/pr31434.C new file mode 100644 index 000000000..97ad079ab --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr31434.C @@ -0,0 +1,12 @@ +// { dg-options "-std=gnu++0x" } +template int foo(const T&) // { dg-error "not expanded with|T" } +{ + union { T t; }; // { dg-error "not expanded with|T" } + return t; +} + +void bar() +{ + foo(0); // { dg-error "no matching" } + // { dg-message "candidate" "candidate note" { target *-*-* } 10 } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31437.C b/gcc/testsuite/g++.dg/cpp0x/pr31437.C new file mode 100644 index 000000000..0b64f7273 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr31437.C @@ -0,0 +1,10 @@ +// { dg-options "-std=gnu++0x" } +template struct A // { dg-error "candidates|A" } +{ + A(T* p) { // { dg-error "parameter packs|T" } + (A*)(p); + } +}; + +A a(0); // { dg-error "no matching" } +// { dg-message "candidate" "candidate note" { target *-*-* } 9 } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31438.C b/gcc/testsuite/g++.dg/cpp0x/pr31438.C new file mode 100644 index 000000000..74738830a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr31438.C @@ -0,0 +1,9 @@ +// { dg-options "-std=gnu++0x" } + +template struct A; +template struct A // { dg-error "parameter packs|U" } +{ + template A(X); +}; + +A a(0); // { dg-error "incomplete type" } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31439.C b/gcc/testsuite/g++.dg/cpp0x/pr31439.C new file mode 100644 index 000000000..9d22b56c2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr31439.C @@ -0,0 +1,8 @@ +// { dg-options "-std=c++0x" } +template struct A; // { dg-error "declaration" } + +template struct A<> {}; // { dg-error "not used in partial specialization|anonymous" } + +template struct A : A {}; // { dg-error "incomplete type" } + +A a; diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31442.C b/gcc/testsuite/g++.dg/cpp0x/pr31442.C new file mode 100644 index 000000000..f4e411c45 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr31442.C @@ -0,0 +1,9 @@ +// { dg-options "-std=gnu++0x" } +template struct A {}; // { dg-error "parameter packs|T|the end|parameter packs|anonymous" } + +struct B +{ + template