diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2021-09-13 19:49:49 +0200 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2021-09-13 19:49:49 +0200 |
commit | b18a97e5dd0935e1c4a626c230f21457d0aad3d5 (patch) | |
tree | c1818f41af6fe780deafb6cd6a183f32085fe654 /gcc/testsuite/gdc.test | |
parent | e76a53644c9d70e998c0d050e9a456af388c6b61 (diff) | |
download | gcc-b18a97e5dd0935e1c4a626c230f21457d0aad3d5.zip gcc-b18a97e5dd0935e1c4a626c230f21457d0aad3d5.tar.gz gcc-b18a97e5dd0935e1c4a626c230f21457d0aad3d5.tar.bz2 |
Merged current trunk to branch.
Diffstat (limited to 'gcc/testsuite/gdc.test')
490 files changed, 6678 insertions, 774 deletions
diff --git a/gcc/testsuite/gdc.test/compilable/99bottles.d b/gcc/testsuite/gdc.test/compilable/99bottles.d index e7d2f77..09360a8 100644 --- a/gcc/testsuite/gdc.test/compilable/99bottles.d +++ b/gcc/testsuite/gdc.test/compilable/99bottles.d @@ -2,7 +2,7 @@ // http://www.digitalmars.com/d/archives/digitalmars/D/announce/4374.html // http://www.99-bottles-of-beer.net/language-d-1212.html -// Displays the "99 bottles of beer" song at compile time, +// Generates the "99 bottles of beer" song at compile time, // using the template metaprograming facilities of D. // No executable is generated. No libraries are used. // Illustrates template default values, template string value parameters, @@ -49,4 +49,505 @@ template beer(int maxbeers, int n = maxbeers) ~ showHowMany!( maxbeers, " on the wall."); } -pragma(msg, beer!(99)); +enum expected = `99 bottles of beer on the wall, +99 bottles of beer. +Take one down and pass it around, +98 bottles of beer on the wall. + +98 bottles of beer on the wall, +98 bottles of beer. +Take one down and pass it around, +97 bottles of beer on the wall. + +97 bottles of beer on the wall, +97 bottles of beer. +Take one down and pass it around, +96 bottles of beer on the wall. + +96 bottles of beer on the wall, +96 bottles of beer. +Take one down and pass it around, +95 bottles of beer on the wall. + +95 bottles of beer on the wall, +95 bottles of beer. +Take one down and pass it around, +94 bottles of beer on the wall. + +94 bottles of beer on the wall, +94 bottles of beer. +Take one down and pass it around, +93 bottles of beer on the wall. + +93 bottles of beer on the wall, +93 bottles of beer. +Take one down and pass it around, +92 bottles of beer on the wall. + +92 bottles of beer on the wall, +92 bottles of beer. +Take one down and pass it around, +91 bottles of beer on the wall. + +91 bottles of beer on the wall, +91 bottles of beer. +Take one down and pass it around, +90 bottles of beer on the wall. + +90 bottles of beer on the wall, +90 bottles of beer. +Take one down and pass it around, +89 bottles of beer on the wall. + +89 bottles of beer on the wall, +89 bottles of beer. +Take one down and pass it around, +88 bottles of beer on the wall. + +88 bottles of beer on the wall, +88 bottles of beer. +Take one down and pass it around, +87 bottles of beer on the wall. + +87 bottles of beer on the wall, +87 bottles of beer. +Take one down and pass it around, +86 bottles of beer on the wall. + +86 bottles of beer on the wall, +86 bottles of beer. +Take one down and pass it around, +85 bottles of beer on the wall. + +85 bottles of beer on the wall, +85 bottles of beer. +Take one down and pass it around, +84 bottles of beer on the wall. + +84 bottles of beer on the wall, +84 bottles of beer. +Take one down and pass it around, +83 bottles of beer on the wall. + +83 bottles of beer on the wall, +83 bottles of beer. +Take one down and pass it around, +82 bottles of beer on the wall. + +82 bottles of beer on the wall, +82 bottles of beer. +Take one down and pass it around, +81 bottles of beer on the wall. + +81 bottles of beer on the wall, +81 bottles of beer. +Take one down and pass it around, +80 bottles of beer on the wall. + +80 bottles of beer on the wall, +80 bottles of beer. +Take one down and pass it around, +79 bottles of beer on the wall. + +79 bottles of beer on the wall, +79 bottles of beer. +Take one down and pass it around, +78 bottles of beer on the wall. + +78 bottles of beer on the wall, +78 bottles of beer. +Take one down and pass it around, +77 bottles of beer on the wall. + +77 bottles of beer on the wall, +77 bottles of beer. +Take one down and pass it around, +76 bottles of beer on the wall. + +76 bottles of beer on the wall, +76 bottles of beer. +Take one down and pass it around, +75 bottles of beer on the wall. + +75 bottles of beer on the wall, +75 bottles of beer. +Take one down and pass it around, +74 bottles of beer on the wall. + +74 bottles of beer on the wall, +74 bottles of beer. +Take one down and pass it around, +73 bottles of beer on the wall. + +73 bottles of beer on the wall, +73 bottles of beer. +Take one down and pass it around, +72 bottles of beer on the wall. + +72 bottles of beer on the wall, +72 bottles of beer. +Take one down and pass it around, +71 bottles of beer on the wall. + +71 bottles of beer on the wall, +71 bottles of beer. +Take one down and pass it around, +70 bottles of beer on the wall. + +70 bottles of beer on the wall, +70 bottles of beer. +Take one down and pass it around, +69 bottles of beer on the wall. + +69 bottles of beer on the wall, +69 bottles of beer. +Take one down and pass it around, +68 bottles of beer on the wall. + +68 bottles of beer on the wall, +68 bottles of beer. +Take one down and pass it around, +67 bottles of beer on the wall. + +67 bottles of beer on the wall, +67 bottles of beer. +Take one down and pass it around, +66 bottles of beer on the wall. + +66 bottles of beer on the wall, +66 bottles of beer. +Take one down and pass it around, +65 bottles of beer on the wall. + +65 bottles of beer on the wall, +65 bottles of beer. +Take one down and pass it around, +64 bottles of beer on the wall. + +64 bottles of beer on the wall, +64 bottles of beer. +Take one down and pass it around, +63 bottles of beer on the wall. + +63 bottles of beer on the wall, +63 bottles of beer. +Take one down and pass it around, +62 bottles of beer on the wall. + +62 bottles of beer on the wall, +62 bottles of beer. +Take one down and pass it around, +61 bottles of beer on the wall. + +61 bottles of beer on the wall, +61 bottles of beer. +Take one down and pass it around, +60 bottles of beer on the wall. + +60 bottles of beer on the wall, +60 bottles of beer. +Take one down and pass it around, +59 bottles of beer on the wall. + +59 bottles of beer on the wall, +59 bottles of beer. +Take one down and pass it around, +58 bottles of beer on the wall. + +58 bottles of beer on the wall, +58 bottles of beer. +Take one down and pass it around, +57 bottles of beer on the wall. + +57 bottles of beer on the wall, +57 bottles of beer. +Take one down and pass it around, +56 bottles of beer on the wall. + +56 bottles of beer on the wall, +56 bottles of beer. +Take one down and pass it around, +55 bottles of beer on the wall. + +55 bottles of beer on the wall, +55 bottles of beer. +Take one down and pass it around, +54 bottles of beer on the wall. + +54 bottles of beer on the wall, +54 bottles of beer. +Take one down and pass it around, +53 bottles of beer on the wall. + +53 bottles of beer on the wall, +53 bottles of beer. +Take one down and pass it around, +52 bottles of beer on the wall. + +52 bottles of beer on the wall, +52 bottles of beer. +Take one down and pass it around, +51 bottles of beer on the wall. + +51 bottles of beer on the wall, +51 bottles of beer. +Take one down and pass it around, +50 bottles of beer on the wall. + +50 bottles of beer on the wall, +50 bottles of beer. +Take one down and pass it around, +49 bottles of beer on the wall. + +49 bottles of beer on the wall, +49 bottles of beer. +Take one down and pass it around, +48 bottles of beer on the wall. + +48 bottles of beer on the wall, +48 bottles of beer. +Take one down and pass it around, +47 bottles of beer on the wall. + +47 bottles of beer on the wall, +47 bottles of beer. +Take one down and pass it around, +46 bottles of beer on the wall. + +46 bottles of beer on the wall, +46 bottles of beer. +Take one down and pass it around, +45 bottles of beer on the wall. + +45 bottles of beer on the wall, +45 bottles of beer. +Take one down and pass it around, +44 bottles of beer on the wall. + +44 bottles of beer on the wall, +44 bottles of beer. +Take one down and pass it around, +43 bottles of beer on the wall. + +43 bottles of beer on the wall, +43 bottles of beer. +Take one down and pass it around, +42 bottles of beer on the wall. + +42 bottles of beer on the wall, +42 bottles of beer. +Take one down and pass it around, +41 bottles of beer on the wall. + +41 bottles of beer on the wall, +41 bottles of beer. +Take one down and pass it around, +40 bottles of beer on the wall. + +40 bottles of beer on the wall, +40 bottles of beer. +Take one down and pass it around, +39 bottles of beer on the wall. + +39 bottles of beer on the wall, +39 bottles of beer. +Take one down and pass it around, +38 bottles of beer on the wall. + +38 bottles of beer on the wall, +38 bottles of beer. +Take one down and pass it around, +37 bottles of beer on the wall. + +37 bottles of beer on the wall, +37 bottles of beer. +Take one down and pass it around, +36 bottles of beer on the wall. + +36 bottles of beer on the wall, +36 bottles of beer. +Take one down and pass it around, +35 bottles of beer on the wall. + +35 bottles of beer on the wall, +35 bottles of beer. +Take one down and pass it around, +34 bottles of beer on the wall. + +34 bottles of beer on the wall, +34 bottles of beer. +Take one down and pass it around, +33 bottles of beer on the wall. + +33 bottles of beer on the wall, +33 bottles of beer. +Take one down and pass it around, +32 bottles of beer on the wall. + +32 bottles of beer on the wall, +32 bottles of beer. +Take one down and pass it around, +31 bottles of beer on the wall. + +31 bottles of beer on the wall, +31 bottles of beer. +Take one down and pass it around, +30 bottles of beer on the wall. + +30 bottles of beer on the wall, +30 bottles of beer. +Take one down and pass it around, +29 bottles of beer on the wall. + +29 bottles of beer on the wall, +29 bottles of beer. +Take one down and pass it around, +28 bottles of beer on the wall. + +28 bottles of beer on the wall, +28 bottles of beer. +Take one down and pass it around, +27 bottles of beer on the wall. + +27 bottles of beer on the wall, +27 bottles of beer. +Take one down and pass it around, +26 bottles of beer on the wall. + +26 bottles of beer on the wall, +26 bottles of beer. +Take one down and pass it around, +25 bottles of beer on the wall. + +25 bottles of beer on the wall, +25 bottles of beer. +Take one down and pass it around, +24 bottles of beer on the wall. + +24 bottles of beer on the wall, +24 bottles of beer. +Take one down and pass it around, +23 bottles of beer on the wall. + +23 bottles of beer on the wall, +23 bottles of beer. +Take one down and pass it around, +22 bottles of beer on the wall. + +22 bottles of beer on the wall, +22 bottles of beer. +Take one down and pass it around, +21 bottles of beer on the wall. + +21 bottles of beer on the wall, +21 bottles of beer. +Take one down and pass it around, +20 bottles of beer on the wall. + +20 bottles of beer on the wall, +20 bottles of beer. +Take one down and pass it around, +19 bottles of beer on the wall. + +19 bottles of beer on the wall, +19 bottles of beer. +Take one down and pass it around, +18 bottles of beer on the wall. + +18 bottles of beer on the wall, +18 bottles of beer. +Take one down and pass it around, +17 bottles of beer on the wall. + +17 bottles of beer on the wall, +17 bottles of beer. +Take one down and pass it around, +16 bottles of beer on the wall. + +16 bottles of beer on the wall, +16 bottles of beer. +Take one down and pass it around, +15 bottles of beer on the wall. + +15 bottles of beer on the wall, +15 bottles of beer. +Take one down and pass it around, +14 bottles of beer on the wall. + +14 bottles of beer on the wall, +14 bottles of beer. +Take one down and pass it around, +13 bottles of beer on the wall. + +13 bottles of beer on the wall, +13 bottles of beer. +Take one down and pass it around, +12 bottles of beer on the wall. + +12 bottles of beer on the wall, +12 bottles of beer. +Take one down and pass it around, +11 bottles of beer on the wall. + +11 bottles of beer on the wall, +11 bottles of beer. +Take one down and pass it around, +10 bottles of beer on the wall. + +10 bottles of beer on the wall, +10 bottles of beer. +Take one down and pass it around, +9 bottles of beer on the wall. + +9 bottles of beer on the wall, +9 bottles of beer. +Take one down and pass it around, +8 bottles of beer on the wall. + +8 bottles of beer on the wall, +8 bottles of beer. +Take one down and pass it around, +7 bottles of beer on the wall. + +7 bottles of beer on the wall, +7 bottles of beer. +Take one down and pass it around, +6 bottles of beer on the wall. + +6 bottles of beer on the wall, +6 bottles of beer. +Take one down and pass it around, +5 bottles of beer on the wall. + +5 bottles of beer on the wall, +5 bottles of beer. +Take one down and pass it around, +4 bottles of beer on the wall. + +4 bottles of beer on the wall, +4 bottles of beer. +Take one down and pass it around, +3 bottles of beer on the wall. + +3 bottles of beer on the wall, +3 bottles of beer. +Take one down and pass it around, +2 bottles of beer on the wall. + +2 bottles of beer on the wall, +2 bottles of beer. +Take one down and pass it around, +1 bottle of beer on the wall. + +1 bottle of beer on the wall, +1 bottle of beer. +Take one down and pass it around, +no more bottles of beer on the wall. + +No more bottles of beer on the wall, +no more bottles of beer. +Go to the store and buy some more, +99 bottles of beer on the wall. +`; + +static assert(beer!(99) == expected); diff --git a/gcc/testsuite/gdc.test/compilable/Test16206.d b/gcc/testsuite/gdc.test/compilable/Test16206.d new file mode 100644 index 0000000..0b9ccf3 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/Test16206.d @@ -0,0 +1,28 @@ +struct S { + static int foo()() { return 0; } + static int foo()(int n) { return 1; } + static int foo(string s) { return 2; } + enum foo(int[] arr) = arr.length; +} + +alias AliasSeq(T...) = T; + +alias allFoos = AliasSeq!(__traits(getOverloads, S, "foo", true)); + +static assert(allFoos.length == 4); + +static assert(allFoos[0]("") == 2); +static assert(allFoos[1]() == 0); +static assert(allFoos[2](1) == 1); +alias foo3 = allFoos[3]; +static assert(foo3!([]) == 0); + +static assert(S.foo() == 0); +static assert(S.foo(1) == 1); +static assert(S.foo("") == 2); +static assert(S.foo!([]) == 0); + + +alias fooFuns = AliasSeq!(__traits(getOverloads, S, "foo")); +static assert(fooFuns.length == 1); +static assert(fooFuns[0]("") == 2);
\ No newline at end of file diff --git a/gcc/testsuite/gdc.test/compilable/aggr_alignment.d b/gcc/testsuite/gdc.test/compilable/aggr_alignment.d index bf602ff..0c727e2 100644 --- a/gcc/testsuite/gdc.test/compilable/aggr_alignment.d +++ b/gcc/testsuite/gdc.test/compilable/aggr_alignment.d @@ -27,6 +27,26 @@ static assert(C2.int1.offsetof == payloadOffset + 8); static assert(C2.alignof == size_t.sizeof); static assert(__traits(classInstanceSize, C2) == payloadOffset + 12); +align(8) struct PaddedStruct +{ + bool flag; + align(2) S1 s1; +} + +static assert(PaddedStruct.s1.offsetof == 2); +static assert(PaddedStruct.alignof == 8); +static assert(PaddedStruct.sizeof == 16); + +align(1) struct UglyStruct +{ + bool flag; + int i; + ubyte u; +} + +static assert(UglyStruct.i.offsetof == 4); +static assert(UglyStruct.alignof == 1); +static assert(UglyStruct.sizeof == 9); /***************************************************/ // https://issues.dlang.org/show_bug.cgi?id=19914 diff --git a/gcc/testsuite/gdc.test/compilable/b16382.d b/gcc/testsuite/gdc.test/compilable/b16382.d index 08726cb..e28ad18 100644 --- a/gcc/testsuite/gdc.test/compilable/b16382.d +++ b/gcc/testsuite/gdc.test/compilable/b16382.d @@ -1,4 +1,10 @@ // REQUIRED_ARGS: -c +/* +TEST_OUTPUT: +--- +&this +--- +*/ struct S0 { void foo() { pragma(msg, &this); diff --git a/gcc/testsuite/gdc.test/compilable/b17111.d b/gcc/testsuite/gdc.test/compilable/b17111.d index 5409124..6bf5da9 100644 --- a/gcc/testsuite/gdc.test/compilable/b17111.d +++ b/gcc/testsuite/gdc.test/compilable/b17111.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +compilable/b17111.d(16): Deprecation: `case` variables have to be `const` or `immutable` +compilable/b17111.d(17): Deprecation: `case` variables have to be `const` or `immutable` +--- +*/ alias TestType = ubyte; void test() diff --git a/gcc/testsuite/gdc.test/compilable/b19002.d b/gcc/testsuite/gdc.test/compilable/b19002.d new file mode 100644 index 0000000..fd8e6d1 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/b19002.d @@ -0,0 +1,12 @@ +module b19002; + +void printf(scope const char* format){} + +void main() +{ + printf(__FILE__); + printf(__FILE_FULL_PATH__); + printf(__FUNCTION__); + printf(__PRETTY_FUNCTION__); + printf(__MODULE__); +} diff --git a/gcc/testsuite/gdc.test/compilable/betterCarray.d b/gcc/testsuite/gdc.test/compilable/betterCarray.d index 74c80be..3f48b04 100644 --- a/gcc/testsuite/gdc.test/compilable/betterCarray.d +++ b/gcc/testsuite/gdc.test/compilable/betterCarray.d @@ -15,3 +15,13 @@ int foo(int[] a, int i) { return a[i]; } + +/**********************************************/ +// https://issues.dlang.org/show_bug.cgi?id=19234 +void issue19234() +{ + static struct A {} + A[10] a; + A[10] b; + b[] = a[]; +} diff --git a/gcc/testsuite/gdc.test/compilable/bug20796.d b/gcc/testsuite/gdc.test/compilable/bug20796.d new file mode 100644 index 0000000..00d00c8 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/bug20796.d @@ -0,0 +1,2 @@ +// EXTRA_SOURCES: protection/issue20796/package.d +// https://issues.dlang.org/show_bug.cgi?id=20796 diff --git a/gcc/testsuite/gdc.test/compilable/checkimports3.d b/gcc/testsuite/gdc.test/compilable/checkimports3.d new file mode 100644 index 0000000..770b382 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/checkimports3.d @@ -0,0 +1,12 @@ +/* +REQUIRED_ARGS: -de +EXTRA_FILES: imports/checkimports3a.d imports/checkimports3b.d imports/checkimports3c.d +*/ +import imports.checkimports3a; +import imports.checkimports3b; +import imports.checkimports3c; + +void test() +{ + foo(); +} diff --git a/gcc/testsuite/gdc.test/compilable/compilable.exp b/gcc/testsuite/gdc.test/compilable/compilable.exp index e2af832..4f3100a 100644 --- a/gcc/testsuite/gdc.test/compilable/compilable.exp +++ b/gcc/testsuite/gdc.test/compilable/compilable.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Free Software Foundation, Inc. +# Copyright (C) 2020-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/gdc.test/compilable/compile1.d b/gcc/testsuite/gdc.test/compilable/compile1.d index 61669c2..86d84af 100644 --- a/gcc/testsuite/gdc.test/compilable/compile1.d +++ b/gcc/testsuite/gdc.test/compilable/compile1.d @@ -15,9 +15,9 @@ static assert(C1748!int.stringof == "C1748!int"); **************************************************/ version(all) - pragma(msg, "true"); + pragma(inline, true); else - pragma(msg, "false"); + pragma(inline, false); /************************************************** 2438 @@ -78,7 +78,7 @@ template ice8982(T) void bug8982(ref const int v = 7){} static if (is(typeof(bug8982) P == __parameters)) { - pragma(msg, ((P[0..1] g) => g[0])()); + enum eval8982 = ((P[0..1] g) => g[0])(); } } @@ -275,7 +275,7 @@ void main() try { } - catch + catch(.object.Throwable) { } } @@ -298,7 +298,7 @@ void test11939() **************************************************/ template A(B) { - pragma(msg, "missing ;") + pragma(lib, "missing ;") enum X = 0; } @@ -766,7 +766,7 @@ struct A12799 /***************************************************/ // 13236 -pragma(msg, is(typeof({ struct S { S x; } }))); +enum bug13286 = is(typeof({ struct S { S x; } })); /***************************************************/ // 13280 @@ -857,14 +857,15 @@ X14166[int] makeAA14166() { return aa14166; } struct Tup14166(T...) { T field; alias field this; } Tup14166!(int, int) tup14166; Tup14166!(int, int) makeTup14166() { return tup14166; } - -pragma(msg, typeof((s14166.x += 1) = 2)); // ok <- error -pragma(msg, typeof(s14166.a.length += 2)); // ok <- error -pragma(msg, typeof(s14166++)); // ok <- error -pragma(msg, typeof(s14166.x ^^ 2)); // ok <- error -pragma(msg, typeof(s14166.y ^^= 2.5)); // ok <- error -pragma(msg, typeof(makeAA14166()[0] = 1)); // ok <- error -pragma(msg, typeof(tup14166.field = makeTup14166())); // ok <- error +alias TT14166(T...) = T; + +static assert(is(typeof((s14166.x += 1) = 2) == int)); // ok <- error +static assert(is(typeof(s14166.a.length += 2) == size_t)); // ok <- error +static assert(is(typeof(s14166++) == S14166)); // ok <- error +static assert(is(typeof(s14166.x ^^ 2) == int)); // ok <- error +static assert(is(typeof(s14166.y ^^= 2.5) == double)); // ok <- error +static assert(is(typeof(makeAA14166()[0] = 1) == X14166)); // ok <- error +static assert(is(typeof(tup14166.field = makeTup14166()) == TT14166!(int, int))); // ok <- error /***************************************************/ // 14388 diff --git a/gcc/testsuite/gdc.test/compilable/cppmangle.d b/gcc/testsuite/gdc.test/compilable/cppmangle.d index 7fcd41a..954a9be 100644 --- a/gcc/testsuite/gdc.test/compilable/cppmangle.d +++ b/gcc/testsuite/gdc.test/compilable/cppmangle.d @@ -372,3 +372,21 @@ version (Posix) static assert(T.boo.mangleof == "_ZN1T3booE"); } +/*****************************************/ + +alias noreturn = typeof(*null); + +extern (C++) +{ + alias fpcpp = noreturn function(); + int funccpp(fpcpp); + + version (Posix) + static assert(funccpp.mangleof == "_Z7funccppPFvvE"); + + version (Win32) + static assert(funccpp.mangleof == "?funccpp@@YAHP6AXXZ@Z"); + + version (Win64) + static assert(funccpp.mangleof == "?funccpp@@YAHP6AXXZ@Z"); +} diff --git a/gcc/testsuite/gdc.test/compilable/ddoc14633.d b/gcc/testsuite/gdc.test/compilable/ddoc14633.d index 759287c..af39633 100644 --- a/gcc/testsuite/gdc.test/compilable/ddoc14633.d +++ b/gcc/testsuite/gdc.test/compilable/ddoc14633.d @@ -1,12 +1,6 @@ // PERMUTE_ARGS: // REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -w -o- -/* -TEST_OUTPUT: ---- ---- -*/ - /** Blah Params: T = some type diff --git a/gcc/testsuite/gdc.test/compilable/ddoc3.d b/gcc/testsuite/gdc.test/compilable/ddoc3.d index bc00b69..1bcae41 100644 --- a/gcc/testsuite/gdc.test/compilable/ddoc3.d +++ b/gcc/testsuite/gdc.test/compilable/ddoc3.d @@ -1,7 +1,7 @@ // EXTRA_SOURCES: extra-files/ddoc3.ddoc // PERMUTE_ARGS: // REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 3 +// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh /** * Summary diff --git a/gcc/testsuite/gdc.test/compilable/ddocunittest.d b/gcc/testsuite/gdc.test/compilable/ddocunittest.d index 940ef1c..8c691b6 100644 --- a/gcc/testsuite/gdc.test/compilable/ddocunittest.d +++ b/gcc/testsuite/gdc.test/compilable/ddocunittest.d @@ -357,6 +357,7 @@ auto redBlackTree(bool allowDuplicates, E)(E[] elems...) } /// ditto auto redBlackTree(alias less, E)(E[] elems...) +if (__traits(compiles, (E a, E b) => mixin(less))) { return 3; } diff --git a/gcc/testsuite/gdc.test/compilable/deprecate14283.d b/gcc/testsuite/gdc.test/compilable/deprecate14283.d index 9c82add..e91db64 100644 --- a/gcc/testsuite/gdc.test/compilable/deprecate14283.d +++ b/gcc/testsuite/gdc.test/compilable/deprecate14283.d @@ -1,11 +1,5 @@ // REQUIRED_ARGS: -dw // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ - class C { void bug() diff --git a/gcc/testsuite/gdc.test/compilable/diag11066.d b/gcc/testsuite/gdc.test/compilable/diag11066.d index 3d93831..598ff85 100644 --- a/gcc/testsuite/gdc.test/compilable/diag11066.d +++ b/gcc/testsuite/gdc.test/compilable/diag11066.d @@ -1,10 +1,4 @@ // REQUIRED_ARGS: -w -profile -/* -TEST_OUTPUT: ---- ---- -*/ - void main() { string s; diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12598.d b/gcc/testsuite/gdc.test/compilable/diag12598.d index 236692d..8f98188 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag12598.d +++ b/gcc/testsuite/gdc.test/compilable/diag12598.d @@ -1,9 +1,6 @@ /* -REQUIRED_ARGS: -transition=import -TEST_OUTPUT: ---- -fail_compilation/diag12598.d(14): Error: struct 'lines' is a type, not an lvalue ---- +REQUIRED_ARGS: +EXTRA_FILES: imports/diag12598a.d */ class C diff --git a/gcc/testsuite/gdc.test/compilable/diag3243.d b/gcc/testsuite/gdc.test/compilable/diag3243.d index b25d0bb..7d034d8 100644 --- a/gcc/testsuite/gdc.test/compilable/diag3243.d +++ b/gcc/testsuite/gdc.test/compilable/diag3243.d @@ -1,11 +1,5 @@ // REQUIRED_ARGS: -vtls // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ - template T() { static this() {} diff --git a/gcc/testsuite/gdc.test/compilable/dip22d.d b/gcc/testsuite/gdc.test/compilable/dip22d.d new file mode 100644 index 0000000..1becf0c --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/dip22d.d @@ -0,0 +1,10 @@ +/* +REQUIRED_ARGS: +*/ + +// https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP22.md + +import imports.dip22d; +import imports.dip22e; + +Foo foo; diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/header1.d b/gcc/testsuite/gdc.test/compilable/extra-files/header1.d index a746a2a..5eb6afd 100644 --- a/gcc/testsuite/gdc.test/compilable/extra-files/header1.d +++ b/gcc/testsuite/gdc.test/compilable/extra-files/header1.d @@ -10,6 +10,30 @@ static assert(true, "message"); alias double mydbl; +alias fl1 = function () + in {} + in (true) + out (; true) + out (r; true) + out + { + } + out (r) + { + } + do + { + return 2; + }; + +alias fl2 = function () + in (true) + out(; true) + out(r; true) + { + return 2; + }; + int testmain() in { @@ -133,11 +157,11 @@ template Foo(T, int V) } try - bar(1, 2); + bar(1, 2); catch(Object o) - x++; + x++; finally - x--; + x--; Object o; synchronized (o) @@ -244,6 +268,7 @@ class Test pure nothrow @safe @nogc unittest {} pure nothrow @safe @nogc invariant {} + pure nothrow @safe @nogc invariant (true); pure nothrow @safe @nogc new (size_t sz) { return null; } pure nothrow @safe @nogc delete (void* p) { } @@ -519,3 +544,21 @@ struct Foo3A(T) @disable this(this); @disable this(); } + +void test13x(@(10) int a, @(20) int, @(30) @(40) int[] arr...) {} + +enum Test14UDA1; +struct Test14UDA2 +{ + string str; +} + +Test14UDA2 test14uda3(string name) +{ + return Test14UDA2(name); +} +struct Test14UDA4(string v){} + +void test14x(@Test14UDA1 int, @Test14UDA2("1") int, @test14uda3("2") int, @Test14UDA4!"3" int) {} + +void test15x(@(20) void delegate(int) @safe dg){} diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/minimal/object.d b/gcc/testsuite/gdc.test/compilable/extra-files/minimal/object.d new file mode 100644 index 0000000..c7060b0 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/extra-files/minimal/object.d @@ -0,0 +1 @@ +module object; diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d b/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d index 9ade317..62de518 100644 --- a/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d +++ b/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d @@ -3,6 +3,12 @@ class Controller { enum _s_pkg = __traits(parent, __traits(parent, __traits(parent, T))).stringof["package ".length .. $]; enum _s_model = T.stringof[0 .. $-`Controller`.length] ~ `Model`; + + import serenity7190.core.Model; + // expands to "import example7190.models.HomeModel;" + mixin(q{import } ~ _s_pkg ~ q{.models.} ~ _s_model ~ q{;}); + + // "enum _ = is(example7190.models.HomeModel.HomeModel : serenity7190.core.Model.Model);" mixin(q{enum _ = is(} ~ _s_pkg ~ q{.models.} ~ _s_model ~ q{.} ~ _s_model ~ q{ : serenity7190.core.Model.Model);}); } -}
\ No newline at end of file +} diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d b/gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d new file mode 100644 index 0000000..edb40954 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d @@ -0,0 +1,12 @@ +module test20280a; + +struct Alpha(uint _) +{ + import test20280a; +} + +struct Foxtrot(uint _) +{ + alias Attributes = Alpha!10; + enum A = 10; +} diff --git a/gcc/testsuite/gdc.test/compilable/fix21585.d b/gcc/testsuite/gdc.test/compilable/fix21585.d new file mode 100644 index 0000000..a83fb89 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/fix21585.d @@ -0,0 +1,24 @@ +/* TEST_OUTPUT: +--- +i int +d double +Pi int* +--- +*/ + +pragma(msg, 1.mangleof, " ", __traits(toType, 1.mangleof)); +pragma(msg, (1.0).mangleof, " ", __traits(toType, (1.0).mangleof)); +pragma(msg, (int*).mangleof, " ", __traits(toType, (int*).mangleof)); + +template Type(T) { alias Type = T; } + +Type!(__traits(toType, 1.mangleof)) j = 3; + +alias T = Type!(__traits(toType, 1.mangleof)); +static assert(is(T == int)); + +__traits(toType, "i") x = 7; + +static assert(is(Type!(__traits(toType, 1.mangleof)) == int)); +static assert(is(Type!(__traits(toType, (1.0).mangleof)) == double)); +static assert(is(Type!(__traits(toType, (int*).mangleof)) == int*)); diff --git a/gcc/testsuite/gdc.test/compilable/fix21647.d b/gcc/testsuite/gdc.test/compilable/fix21647.d new file mode 100644 index 0000000..c129fa0 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/fix21647.d @@ -0,0 +1,30 @@ +/* +REQUIRED_ARGS: +TEST_OUTPUT: +--- +cast(void)0 +cast(void)0 +void +cast(void)0 +cast(void)0 +cast(void)0 +void +--- +*/ + + +// https://issues.dlang.org/show_bug.cgi?id=21647 + +void foo() { return cast(void)1; } + +void main(){} + +alias V = void; + +void test1() { pragma(msg, foo()); } +void test2() { pragma(msg, main()); } +void test3() { pragma(msg, V); } + +pragma(msg, foo()); +pragma(msg, main()); +pragma(msg, V); diff --git a/gcc/testsuite/gdc.test/compilable/ice10598.d b/gcc/testsuite/gdc.test/compilable/ice10598.d deleted file mode 100644 index 58a7c3b..0000000 --- a/gcc/testsuite/gdc.test/compilable/ice10598.d +++ /dev/null @@ -1,3 +0,0 @@ -// EXTRA_SOURCES: imports/ice10598a.d imports/ice10598b.d - -void main() {} diff --git a/gcc/testsuite/gdc.test/compilable/ice10770.d b/gcc/testsuite/gdc.test/compilable/ice10770.d new file mode 100644 index 0000000..cf55833 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/ice10770.d @@ -0,0 +1,5 @@ +enum E1 : int; +static assert(is(E1 e == enum) && is(e == int)); + +enum E2; +static assert(is(E2 e == enum)); diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3a.d b/gcc/testsuite/gdc.test/compilable/imports/checkimports3a.d index 85e6cd8..85e6cd8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3a.d +++ b/gcc/testsuite/gdc.test/compilable/imports/checkimports3a.d diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3b.d b/gcc/testsuite/gdc.test/compilable/imports/checkimports3b.d index 37ea7ae..37ea7ae 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3b.d +++ b/gcc/testsuite/gdc.test/compilable/imports/checkimports3b.d diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3c.d b/gcc/testsuite/gdc.test/compilable/imports/checkimports3c.d index 93b4ac5..93b4ac5 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3c.d +++ b/gcc/testsuite/gdc.test/compilable/imports/checkimports3c.d diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag12598a.d b/gcc/testsuite/gdc.test/compilable/imports/diag12598a.d index dee0054..dee0054 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/imports/diag12598a.d +++ b/gcc/testsuite/gdc.test/compilable/imports/diag12598a.d diff --git a/gcc/testsuite/gdc.test/compilable/imports/dip22d.d b/gcc/testsuite/gdc.test/compilable/imports/dip22d.d new file mode 100644 index 0000000..9f80442 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/dip22d.d @@ -0,0 +1,5 @@ +module imports.dip22d; + +private struct Foo {} +private void foo() {} +private void bar() {} diff --git a/gcc/testsuite/gdc.test/compilable/imports/dip22e.d b/gcc/testsuite/gdc.test/compilable/imports/dip22e.d new file mode 100644 index 0000000..3464e60 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/dip22e.d @@ -0,0 +1,4 @@ +module imports.dip22e; + +public struct Foo {} +public void bar(int) {} diff --git a/gcc/testsuite/gdc.test/compilable/imports/issue21614a.d b/gcc/testsuite/gdc.test/compilable/imports/issue21614a.d new file mode 100644 index 0000000..ee3c9eb --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/issue21614a.d @@ -0,0 +1,22 @@ +module imports.issue21614a; + +struct FormatSpec(Char) +{ + import imports.issue21614a; +} + +template Tuple(Specs...) +{ + struct Tuple + { + alias spec = FormatSpec!char(); + this(Specs) + { + } + } +} + +auto findRoot(T)(T) +{ + return Tuple!(T)(); +} diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d new file mode 100644 index 0000000..a517957 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d @@ -0,0 +1,4 @@ +module pkg16044; + +int test1; +int test2; diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d new file mode 100644 index 0000000..4c96e12 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d @@ -0,0 +1,4 @@ +module pkg16044.sub; + +int test3; +int test4; diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg20537/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkg20537/package.d new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/pkg20537/package.d diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkgmodule/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkgmodule/package.d new file mode 100644 index 0000000..b6e98ff --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/pkgmodule/package.d @@ -0,0 +1,3 @@ +/// Used to test is(x == package) and is(x == module) + +module imports.pkgmodule; diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkgmodule/plainmodule.d b/gcc/testsuite/gdc.test/compilable/imports/pkgmodule/plainmodule.d new file mode 100644 index 0000000..948a87e --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/pkgmodule/plainmodule.d @@ -0,0 +1,2 @@ +/// Used to test is(x == module) +module imports.pkgmodule.plainmodule; diff --git a/gcc/testsuite/gdc.test/compilable/imports/plainpackage/plainmodule.d b/gcc/testsuite/gdc.test/compilable/imports/plainpackage/plainmodule.d new file mode 100644 index 0000000..9e9933b --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/plainpackage/plainmodule.d @@ -0,0 +1,4 @@ +/// Used to test is(x == module) + +module imports.plainpackage.plainmodule; + diff --git a/gcc/testsuite/gdc.test/compilable/imports/test15371.d b/gcc/testsuite/gdc.test/compilable/imports/test15371.d new file mode 100644 index 0000000..49b446a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test15371.d @@ -0,0 +1,9 @@ +module imports.test15371; + +struct A +{ + private int a; + private void fun() {} + private void fun(int, int) {} + public void fun(int) {} +} diff --git a/gcc/testsuite/gdc.test/compilable/imports/test17991a/a.d b/gcc/testsuite/gdc.test/compilable/imports/test17991a/a.d new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test17991a/a.d diff --git a/gcc/testsuite/gdc.test/compilable/imports/test17991a/package.d b/gcc/testsuite/gdc.test/compilable/imports/test17991a/package.d new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test17991a/package.d diff --git a/gcc/testsuite/gdc.test/compilable/imports/test20151a/b/c/c.d b/gcc/testsuite/gdc.test/compilable/imports/test20151a/b/c/c.d new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test20151a/b/c/c.d diff --git a/gcc/testsuite/gdc.test/compilable/imports/test20530a.d b/gcc/testsuite/gdc.test/compilable/imports/test20530a.d new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test20530a.d diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21501b.d b/gcc/testsuite/gdc.test/compilable/imports/test21501b.d new file mode 100644 index 0000000..c1f8fab --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test21501b.d @@ -0,0 +1,7 @@ +module imports.test21501b; +import test21501a; + +struct B +{ + A data; +} diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21501c.d b/gcc/testsuite/gdc.test/compilable/imports/test21501c.d new file mode 100644 index 0000000..cc1f95f --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test21501c.d @@ -0,0 +1,4 @@ +module imports.test21501c; + +alias C = int; +const D = 1; diff --git a/gcc/testsuite/gdc.test/compilable/interpret3.d b/gcc/testsuite/gdc.test/compilable/interpret3.d index 6e7304d..a2830ea 100644 --- a/gcc/testsuite/gdc.test/compilable/interpret3.d +++ b/gcc/testsuite/gdc.test/compilable/interpret3.d @@ -1,4 +1,11 @@ -// PERMUTE_ARGS: -inline +// PERMUTE_ARGS: -inline +/* +TEST_OUTPUT: +--- +compilable/interpret3.d(2914): Deprecation: `case` variables have to be `const` or `immutable` +compilable/interpret3.d(6351): Deprecation: identity comparison of static arrays implicitly coerces them to slices, which are compared by reference +--- +*/ template compiles(int T) { diff --git a/gcc/testsuite/gdc.test/compilable/interpret5.d b/gcc/testsuite/gdc.test/compilable/interpret5.d new file mode 100644 index 0000000..ce13a5a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/interpret5.d @@ -0,0 +1,30 @@ +// https://issues.dlang.org/show_bug.cgi?id=21927 +/* +TEST_OUTPUT: +--- +T1(Args...) +T1!() +T2(Args2...) +T2!() +this.T2(Args2...) +this.T2!() +--- +*/ +template T1(Args...) {} + +pragma(msg, T1); // TOK.template_ +pragma(msg, T1!()); // TOK.scope_ + +struct S +{ + template T2(Args2...) {} + + pragma(msg, S.T2); // TOK.template_ + pragma(msg, S.T2!()); // TOK.scope_ + + void fun() + { + pragma(msg, this.T2); // TOK.dotTemplateDeclaration + pragma(msg, this.T2!()); // TOK.dot + } +} diff --git a/gcc/testsuite/gdc.test/compilable/isZeroInit.d b/gcc/testsuite/gdc.test/compilable/isZeroInit.d new file mode 100644 index 0000000..b5423cf --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/isZeroInit.d @@ -0,0 +1,78 @@ +alias AliasSeq(T...) = T; + +struct Holder(T, ubyte val) +{ + T x = val; +} + +struct SArrayHolder(T, ubyte val) +{ + T[2] x = val; +} + +static foreach (T; AliasSeq!(bool, byte, short, int, long, + ubyte, ushort, uint, ulong, + char, wchar, dchar, + float, double, real)) +{ + static assert(__traits(isZeroInit, T) == (T.init is T(0))); + static assert(__traits(isZeroInit, T[2]) == (T.init is T(0))); + + static assert(!__traits(isZeroInit, Holder!(T, 1))); + static assert(__traits(isZeroInit, Holder!(T, 0))); + + static assert(__traits(isZeroInit, SArrayHolder!(T, 0))); + static assert(!__traits(isZeroInit, SArrayHolder!(T, 1))); + +} + +static assert(__traits(isZeroInit, void)); // For initializing arrays of element type `void`. +static assert(__traits(isZeroInit, void*)); +static assert(__traits(isZeroInit, void[])); +static assert(__traits(isZeroInit, float[])); +static assert(__traits(isZeroInit, Object)); +class C1 : Object +{ + int x = 1; +} +static assert(__traits(isZeroInit, C1)); // An Object's fields are irrelevant. + +struct S1 +{ + int[] a; + int b; +} +static assert(__traits(isZeroInit, S1)); + +struct S2 +{ + alias H = Holder!(int, 1); + H h; + int a; +} +static assert(!__traits(isZeroInit, S2)); + +struct S3 +{ + S1 h; + float f = 0; +} +static assert(__traits(isZeroInit, S3)); + +struct S4 +{ + S2 h = S2(S2.H(0), 0); + int a; +} +static assert(__traits(isZeroInit, S4)); + +struct S5 +{ + Object o = null; +} +static assert(__traits(isZeroInit, S5)); + +version(D_SIMD): +import core.simd : int4; +static assert(__traits(isZeroInit, Holder!(int4, 0))); +static assert(!__traits(isZeroInit, Holder!(int4, 1))); diff --git a/gcc/testsuite/gdc.test/compilable/isreturnonstack.d b/gcc/testsuite/gdc.test/compilable/isreturnonstack.d new file mode 100644 index 0000000..8bdb97d --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/isreturnonstack.d @@ -0,0 +1,7 @@ +struct S { int[10] a; } +int test1(); +S test2(); + +static assert(__traits(isReturnOnStack, test1) == false); +static assert(__traits(isReturnOnStack, test2) == true); + diff --git a/gcc/testsuite/gdc.test/compilable/issue16020.d b/gcc/testsuite/gdc.test/compilable/issue16020.d new file mode 100644 index 0000000..cfd078c --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue16020.d @@ -0,0 +1,39 @@ +module issue16020; + +alias F1 = const(int)(); const(int) f1(){return 42;} +static assert (is(F1 == typeof(f1))); + +alias F2 = float(float); float f2(float p){return p;} +static assert (is(F2 == typeof(f2))); + +alias F3 = void(); void f3(){} +static assert (is(F3 == typeof(f3))); + +alias void F41() @safe; +alias F42 = void() @safe; +alias F43 = @safe void(); +static assert (is(F41 == F42)); +static assert (is(F43 == F42)); + +alias void F51() @system; +alias F52 = void() @safe; +static assert (!is(F51 == F52)); + +alias F61 = int() const shared; +alias int F62() const shared ; +alias F63 = const shared int(); +static assert (is(F61 == F62)); +static assert (is(F63 == F62)); + +alias F71 = int() immutable inout; +alias int F72() immutable inout; +alias F73 = immutable inout int(); +static assert (is(F71 == F72)); +static assert (is(F73 == F72)); + +alias FunTemplate(T) = void(T t); +alias Specialized = FunTemplate!int; +alias Compared = void(int); +static assert(is(Specialized == Compared)); + +void main() {} diff --git a/gcc/testsuite/gdc.test/compilable/issue16044.d b/gcc/testsuite/gdc.test/compilable/issue16044.d new file mode 100644 index 0000000..e959e2e --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue16044.d @@ -0,0 +1,9 @@ +// REQUIRED_ARGS: -Icompilable/imports +// EXTRA_FILES: imports/pkg16044/package.d imports/pkg16044/sub/package.d +module issue16044; // https://issues.dlang.org/show_bug.cgi?id=16044 + +import pkg16044; +import pkg16044.sub; + +static assert([__traits(allMembers, pkg16044)] == ["object", "test1", "test2"]); +static assert([__traits(allMembers, pkg16044.sub)] == ["object", "test3", "test4"]); diff --git a/gcc/testsuite/gdc.test/compilable/issue20915.d b/gcc/testsuite/gdc.test/compilable/issue20915.d new file mode 100644 index 0000000..dd8b7b5 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue20915.d @@ -0,0 +1,10 @@ +module issue20915; + +// prior to the PR adding this test case, +// locally defined version and debug idents were included. +version = illegal; +debug = illegal; + +alias Seq(T...) = T; + +static assert (__traits(allMembers, issue20915) == Seq!("object", "Seq")); diff --git a/gcc/testsuite/gdc.test/compilable/issue21614.d b/gcc/testsuite/gdc.test/compilable/issue21614.d new file mode 100644 index 0000000..1843fe6 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue21614.d @@ -0,0 +1,10 @@ +// EXTRA_FILES: imports/issue21614a.d +// REQUIRED_ARGS: -i + +// https://issues.dlang.org/show_bug.cgi?id=21614 + +void logmdigammaInverse(real y) +{ + import imports.issue21614a; + findRoot(y); +} diff --git a/gcc/testsuite/gdc.test/compilable/issue21726.d b/gcc/testsuite/gdc.test/compilable/issue21726.d new file mode 100644 index 0000000..c8a8675 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue21726.d @@ -0,0 +1,2 @@ +// EXTRA_SOURCES: protection/issue21726/typecons.d +// https://issues.dlang.org/show_bug.cgi?id=21726 diff --git a/gcc/testsuite/gdc.test/compilable/issue21813a.d b/gcc/testsuite/gdc.test/compilable/issue21813a.d new file mode 100644 index 0000000..f07b47a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue21813a.d @@ -0,0 +1,13 @@ +// https://issues.dlang.org/show_bug.cgi?id=21813 +Target.OS defaultTargetOS() +{ + return Target.OS.linux; +} + +struct Target +{ + enum OS { linux } + OS os = defaultTargetOS(); + void deinitialize() { this = this.init; } + @property isPOSIX() scope @nogc { } +} diff --git a/gcc/testsuite/gdc.test/compilable/issue21813b.d b/gcc/testsuite/gdc.test/compilable/issue21813b.d new file mode 100644 index 0000000..ef22697 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue21813b.d @@ -0,0 +1,13 @@ +// https://issues.dlang.org/show_bug.cgi?id=21813 +Target.OS defaultTargetOS() +{ + return Target.OS.linux; +} + +struct Target +{ + enum OS { linux } + OS os = defaultTargetOS(); + @property isPOSIX() scope @nogc { } +} + diff --git a/gcc/testsuite/gdc.test/compilable/line.d b/gcc/testsuite/gdc.test/compilable/line.d index 5122ed3..14e1789 100644 --- a/gcc/testsuite/gdc.test/compilable/line.d +++ b/gcc/testsuite/gdc.test/compilable/line.d @@ -19,12 +19,12 @@ static assert(__FILE_FULL_PATH__[$-__FILE__.length..$] == __FILE__); static assert(__LINE__ == 101); static assert(__FILE__ == "newfile.d"); -static assert(__FILE_FULL_PATH__ == "newfile.d"); +static assert(__FILE_FULL_PATH__[$ - 9 .. $] == "newfile.d"); # line 200 static assert(__LINE__ == 201); static assert(__FILE__ == "newfile.d"); -static assert(__FILE_FULL_PATH__ == "newfile.d"); +static assert(__FILE_FULL_PATH__[$ - 9 .. $] == "newfile.d"); diff --git a/gcc/testsuite/gdc.test/compilable/minimal3.d b/gcc/testsuite/gdc.test/compilable/minimal3.d new file mode 100644 index 0000000..e8106b6 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/minimal3.d @@ -0,0 +1,36 @@ +// DFLAGS: +// REQUIRED_ARGS: -defaultlib= +// EXTRA_SOURCES: extra-files/minimal/object.d + +/**********************************************/ +// https://issues.dlang.org/show_bug.cgi?id=19234 +void issue19234() +{ + static struct A {} + A[10] a; + A[10] b; + b[] = a[]; +} + +/**********************************************/ +// https://issues.dlang.org/show_bug.cgi?id=22005 +void issue22005() +{ + enum int[4] foo = [1,2,3,4]; + static foreach (i, e; foo) + { + } +} + +/**********************************************/ +// https://issues.dlang.org/show_bug.cgi?id=22006 +void issue22006() +{ + alias size_t = typeof(int.sizeof); + alias AliasSeq(T...) = T; + + foreach (size_t i, e; [0, 1, 2, 3]) { } + static foreach (size_t i, e; [0, 1, 2, 3]) { } + foreach (size_t i, e; AliasSeq!(0, 1, 2, 3)) { } + static foreach (size_t i, e; AliasSeq!(0, 1, 2, 3)) { } +} diff --git a/gcc/testsuite/gdc.test/compilable/mixintype.d b/gcc/testsuite/gdc.test/compilable/mixintype.d new file mode 100644 index 0000000..abbf85a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/mixintype.d @@ -0,0 +1,55 @@ + +alias Int = mixin("int"); +alias Lint = mixin("Int"); + +int test1(mixin("int")* p) +{ + mixin("int")[] a; + mixin("int[]") b; + mixin("int[] c;"); + mixin("*p = c[0];"); + *p = mixin("c[0]"); + return *p + a[0] + b[0] + c[0]; +} + +/******************************************/ + +void test2() +{ + auto a = __traits(allMembers, mixin(__MODULE__)); +} + +/*****************************************/ + +void test3() +{ + char val; + int mod; + enum b = __traits(compiles, mixin("*cast(int*)&val + mod")); + static assert(b == true); +} + +/********************************************/ + + +struct S +{ + int fielda; + int fieldb; +} + +template Foo4(alias T) +{ + enum Foo4 = true; +} + +void test4() +{ + S sa; + auto a = Foo4!( __traits(getMember,sa,"fielda") ); + + S sb; + enum getStuff = q{ __traits(getMember,sb,"fieldb") }; + auto b = Foo4!(mixin(getStuff)); +} + diff --git a/gcc/testsuite/gdc.test/compilable/mixintype2.d b/gcc/testsuite/gdc.test/compilable/mixintype2.d new file mode 100644 index 0000000..43803df --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/mixintype2.d @@ -0,0 +1,68 @@ + +alias fun = mixin("(){}"); + +void test1() +{ + int x = 1; + static immutable c = 2; + + fun(); + foo!(mixin("int"))(); + foo!(mixin("long*"))(); + foo!(mixin("ST!(int, S.T)"))(); + foo!(mixin(ST!(int, S.T)))(); + + int[mixin("string")] a1; + int[mixin("5")] a2; + int[mixin("c")] a3; + int[] v1 = new int[mixin("3")]; + auto v2 = new int[mixin("x")]; + + mixin(q{__traits(getMember, S, "T")}) ftv; + + alias T = int*; + static assert(__traits(compiles, mixin("int"))); + static assert(__traits(compiles, mixin(q{int[mixin("string")]}))); + static assert(__traits(compiles, mixin(q{int[mixin("2")]}))); + static assert(__traits(compiles, mixin(T))); + static assert(__traits(compiles, mixin("int*"))); + static assert(__traits(compiles, mixin(typeof(0)))); +} + +struct S { alias T = float*; } + +struct ST(X,Y) {} + +void foo(alias t)() {} + +/**************************************************/ +// https://issues.dlang.org/show_bug.cgi?id=21074 + +alias Byte = ubyte; +alias Byte2(A) = ubyte; +alias T0 = mixin(q{const(Byte)})*; +alias T1 = mixin(q{const(Byte[1])})*; +alias T2 = mixin(q{const(Byte2!int)})*; +alias T3 = mixin(q{const(mixin(Byte2!int))})*; +alias T4 = mixin(q{const(mixin("__traits(getMember, S, \"T\")"))})*; +alias T5 = const(mixin(q{Byte}))*; +alias T6 = const(mixin(q{immutable(Byte)}))*; +alias T7 = const(mixin(q{shared(Byte)}))*; +alias T8 = const(mixin(q{Byte*})); + +// the following tests now work +static assert(is(T0 == const(ubyte)*)); +static assert(is(T1 == const(ubyte[1])*)); +static assert(is(T2 == const(ubyte)*)); +static assert(is(T3 == const(ubyte)*)); +static assert(is(T4 == const(float*)*)); +static assert(is(T5 == const(ubyte)*)); +static assert(is(T6 == immutable(ubyte)*)); +static assert(is(T7 == const(shared(ubyte))*)); +static assert(is(T8 == const(ubyte*))); + +// this doesn't work but I'll file a new issue +/* +alias T8 = mixin(q{immutable(__traits(getMember, S, "T"))})*; +static assert(is(T8 == immutable(float*)*)); +*/ diff --git a/gcc/testsuite/gdc.test/compilable/noreturn1.d b/gcc/testsuite/gdc.test/compilable/noreturn1.d new file mode 100644 index 0000000..e21adc4 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/noreturn1.d @@ -0,0 +1,21 @@ +/* +TEST_OUTPUT: +--- +noreturn +--- +*/ + +alias noreturn = typeof(*null); +pragma(msg, noreturn); + +noreturn exits(int* p) { *p = 3; } + +noreturn exit(); + +int test1(int i) +{ + if (exit()) + return i + 1; + return i - 1; +} + diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d b/gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d new file mode 100644 index 0000000..d0b5f5a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d @@ -0,0 +1,5 @@ +module issue20796; + +package(issue20796) void foo() +{ +} diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d b/gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d new file mode 100644 index 0000000..e0f6ba7 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d @@ -0,0 +1,7 @@ +module protection.issue21726.format; + +package(protection.issue21726.format): + +package(protection.issue21726) int issuePkgSym; +package(protection) int protectionPkgSym(); +int formatPkgSym; diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d b/gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d new file mode 100644 index 0000000..f8986c9 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d @@ -0,0 +1 @@ +module protection.issue21726; diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d b/gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d new file mode 100644 index 0000000..faed95e --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d @@ -0,0 +1,6 @@ +module protection.issue21726.typecons; + +import protection.issue21726.format : issuePkgSym; +import protection.issue21726.format : protectionPkgSym; +static assert(!__traits(compiles, + { import protection.issue21726.format : formatPkgSym; })); diff --git a/gcc/testsuite/gdc.test/compilable/staticforeach.d b/gcc/testsuite/gdc.test/compilable/staticforeach.d index 48d06b4..8a54f32 100644 --- a/gcc/testsuite/gdc.test/compilable/staticforeach.d +++ b/gcc/testsuite/gdc.test/compilable/staticforeach.d @@ -115,6 +115,8 @@ bug17688 T foo2 T2 +TestStaticForeach2 +issue22007 1 2 '3' 2 3 '4' 0 1 @@ -840,3 +842,39 @@ struct T2{ struct S{} } static assert(is(__traits(parent,T2.S)==T2)); + +struct TestStaticForeach2 +{ +static: + // StringExp + char[] test(string str)() + { + char[] s; + static foreach (c; str) + { + s ~= c; + } + return s; + } + static assert(test!"tёstñ" == ['t', '\xd1', '\x91', 's', 't', '\xc3', '\xb1']); + + static foreach (c; "") + { + static assert(0); + } + + // NullExp + enum int[] a = null; + static foreach (c; a) + { + static assert(0); + } +} + +//https://issues.dlang.org/show_bug.cgi?id=22007 +void issue22007() +{ + immutable int[32] array = 1; + foreach (size_t a, int b; array) {} + static foreach (size_t a, int b; array) { } +} diff --git a/gcc/testsuite/gdc.test/compilable/test11563.d b/gcc/testsuite/gdc.test/compilable/test11563.d index b208215b..6fb39fe 100644 --- a/gcc/testsuite/gdc.test/compilable/test11563.d +++ b/gcc/testsuite/gdc.test/compilable/test11563.d @@ -3,7 +3,7 @@ import imports.test11563std_traits; interface J : I {} // comment out to let compilation succeed struct A { } -pragma(msg, moduleName!A); +static assert(moduleName!A == "b"); interface I {} diff --git a/gcc/testsuite/gdc.test/compilable/test12527.d b/gcc/testsuite/gdc.test/compilable/test12527.d index b075b9e..b476c17 100644 --- a/gcc/testsuite/gdc.test/compilable/test12527.d +++ b/gcc/testsuite/gdc.test/compilable/test12527.d @@ -2,9 +2,7 @@ @system: alias Fun = void function() @safe; - pragma (msg, Fun.stringof); static assert(Fun.stringof == "void function() @safe"); alias Del = void delegate() @safe; - pragma (msg, Del.stringof); static assert(Del.stringof == "void delegate() @safe"); diff --git a/gcc/testsuite/gdc.test/compilable/test12567a.d b/gcc/testsuite/gdc.test/compilable/test12567a.d index 53cc377..464c840 100644 --- a/gcc/testsuite/gdc.test/compilable/test12567a.d +++ b/gcc/testsuite/gdc.test/compilable/test12567a.d @@ -1,10 +1,5 @@ // REQUIRED_ARGS: // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ deprecated module test12567a; diff --git a/gcc/testsuite/gdc.test/compilable/test12567b.d b/gcc/testsuite/gdc.test/compilable/test12567b.d index 2e37d31..9b9d7e1 100644 --- a/gcc/testsuite/gdc.test/compilable/test12567b.d +++ b/gcc/testsuite/gdc.test/compilable/test12567b.d @@ -1,10 +1,5 @@ // REQUIRED_ARGS: // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ deprecated("message") module test12567b; diff --git a/gcc/testsuite/gdc.test/compilable/test12567d.d b/gcc/testsuite/gdc.test/compilable/test12567d.d index 512f0b7..ee7bc29 100644 --- a/gcc/testsuite/gdc.test/compilable/test12567d.d +++ b/gcc/testsuite/gdc.test/compilable/test12567d.d @@ -1,10 +1,5 @@ // REQUIRED_ARGS: -d // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ import imports.a12567; void main() { foo(); } diff --git a/gcc/testsuite/gdc.test/compilable/test12567e.d b/gcc/testsuite/gdc.test/compilable/test12567e.d index 14c72bc..2e74cf7 100644 --- a/gcc/testsuite/gdc.test/compilable/test12567e.d +++ b/gcc/testsuite/gdc.test/compilable/test12567e.d @@ -1,7 +1,2 @@ // REQUIRED_ARGS: -o- -/* -TEST_OUTPUT: ---- ---- -*/ deprecated("a" ~ "b") module fail12567; diff --git a/gcc/testsuite/gdc.test/compilable/test13053.d b/gcc/testsuite/gdc.test/compilable/test13053.d index 3f8b421..ddd4c90 100644 --- a/gcc/testsuite/gdc.test/compilable/test13053.d +++ b/gcc/testsuite/gdc.test/compilable/test13053.d @@ -1,10 +1,4 @@ // PERMUTE_ARGS: -w -wi -/* -TEST_OUTPUT: ---- ---- -*/ - @system: struct S diff --git a/gcc/testsuite/gdc.test/compilable/test14375.d b/gcc/testsuite/gdc.test/compilable/test14375.d index 30206d8..ccff8d5 100644 --- a/gcc/testsuite/gdc.test/compilable/test14375.d +++ b/gcc/testsuite/gdc.test/compilable/test14375.d @@ -1,8 +1,4 @@ -/* -TEST_OUTPUT: ---- ---- - */ +// https://issues.dlang.org/show_bug.cgi?id=14375 interface IKeysAPI(string greetings) { static assert(greetings == "Hello world", greetings); } diff --git a/gcc/testsuite/gdc.test/compilable/test15019.d b/gcc/testsuite/gdc.test/compilable/test15019.d index c294875..963dba8 100644 --- a/gcc/testsuite/gdc.test/compilable/test15019.d +++ b/gcc/testsuite/gdc.test/compilable/test15019.d @@ -42,15 +42,15 @@ alias mat4x4 mat4; string definePostfixAliases(string type) { return "alias " ~ type ~ "!byte " ~ type ~ "b;\n" -"alias " ~ type ~ "!ubyte " ~ type ~ "ub;\n" -"alias " ~ type ~ "!short " ~ type ~ "s;\n" -"alias " ~ type ~ "!ushort " ~ type ~ "us;\n" -"alias " ~ type ~ "!int " ~ type ~ "i;\n" -"alias " ~ type ~ "!uint " ~ type ~ "ui;\n" -"alias " ~ type ~ "!long " ~ type ~ "l;\n" -"alias " ~ type ~ "!ulong " ~ type ~ "ul;\n" -"alias " ~ type ~ "!float " ~ type ~ "f;\n" -"alias " ~ type ~ "!double " ~ type ~ "d;\n"; +~ "alias " ~ type ~ "!ubyte " ~ type ~ "ub;\n" +~ "alias " ~ type ~ "!short " ~ type ~ "s;\n" +~ "alias " ~ type ~ "!ushort " ~ type ~ "us;\n" +~ "alias " ~ type ~ "!int " ~ type ~ "i;\n" +~ "alias " ~ type ~ "!uint " ~ type ~ "ui;\n" +~ "alias " ~ type ~ "!long " ~ type ~ "l;\n" +~ "alias " ~ type ~ "!ulong " ~ type ~ "ul;\n" +~ "alias " ~ type ~ "!float " ~ type ~ "f;\n" +~ "alias " ~ type ~ "!double " ~ type ~ "d;\n"; } // define a lot of type names diff --git a/gcc/testsuite/gdc.test/compilable/test15326.d b/gcc/testsuite/gdc.test/compilable/test15326.d index 05c942b..c88f5d0 100644 --- a/gcc/testsuite/gdc.test/compilable/test15326.d +++ b/gcc/testsuite/gdc.test/compilable/test15326.d @@ -5,19 +5,19 @@ private struct _NestedSym_ { static if ((void*).sizeof == 8) { - pragma(msg, "64"); + int pointersize = 64; } else { - pragma(msg, "32"); + int pointersize = 32; } version (X86_64) { - pragma(msg, "X86_64"); + string arch = "X86_64"; } else { - pragma(msg, "Not 64"); + string arch = "Not 64"; } } diff --git a/gcc/testsuite/gdc.test/compilable/test15371.d b/gcc/testsuite/gdc.test/compilable/test15371.d new file mode 100644 index 0000000..6e762be --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test15371.d @@ -0,0 +1,10 @@ +// EXTRA_FILES: imports/test15371.d +import imports.test15371; + +void main() +{ + A a; + static assert(__traits(hasMember, A, "a")); + static assert(__traits(getOverloads, A, "fun").length == 3); + static assert(__traits(compiles, __traits(getMember, a, "a") )); +} diff --git a/gcc/testsuite/gdc.test/compilable/test15785.d b/gcc/testsuite/gdc.test/compilable/test15785.d index c8ad240..483c080 100644 --- a/gcc/testsuite/gdc.test/compilable/test15785.d +++ b/gcc/testsuite/gdc.test/compilable/test15785.d @@ -1,10 +1,5 @@ // REQUIRED_ARGS: -de // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ import imports.test15785; class Derived : Base, IBase2 diff --git a/gcc/testsuite/gdc.test/compilable/test15856.d b/gcc/testsuite/gdc.test/compilable/test15856.d index b61d1c4..8a5c425 100644 --- a/gcc/testsuite/gdc.test/compilable/test15856.d +++ b/gcc/testsuite/gdc.test/compilable/test15856.d @@ -1,4 +1,4 @@ -// REQUIRED_ARGS: -transition=checkimports -de +// REQUIRED_ARGS: -de // PERMUTE_ARGS: /* TEST_PUTPUT: diff --git a/gcc/testsuite/gdc.test/compilable/test15925.d b/gcc/testsuite/gdc.test/compilable/test15925.d deleted file mode 100644 index 871af4e..0000000 --- a/gcc/testsuite/gdc.test/compilable/test15925.d +++ /dev/null @@ -1,18 +0,0 @@ -/* REQUIRED_ARGS: -transition=import -transition=checkimports -PERMUTE_ARGS: -TEST_OUTPUT: ---- -compilable/test15925.d(17): Deprecation: local import search method found variable imp15925.X instead of nothing ---- -*/ - -mixin template Import() -{ - import imports.imp15925; -} - -class Foo -{ - mixin Import!(); - static assert(X == 1); -} diff --git a/gcc/testsuite/gdc.test/compilable/test16002.d b/gcc/testsuite/gdc.test/compilable/test16002.d new file mode 100644 index 0000000..f7b4c2e --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test16002.d @@ -0,0 +1,27 @@ +module test.compilable.test16002; + +import imports.plainpackage.plainmodule; +import imports.pkgmodule.plainmodule; + +struct MyStruct; + +alias a = imports.plainpackage; +alias b = imports.pkgmodule.plainmodule; + +static assert(is(imports.plainpackage == package)); +static assert(is(a == package)); +static assert(!is(imports.plainpackage.plainmodule == package)); +static assert(!is(b == package)); +static assert(is(imports.pkgmodule == package)); +static assert(!is(MyStruct == package)); + +static assert(!is(imports.plainpackage == module)); +static assert(!is(a == module)); +static assert(is(imports.plainpackage.plainmodule == module)); +static assert(is(b == module)); +// This is supposed to work even though we haven't directly imported imports.pkgmodule. +static assert(is(imports.pkgmodule == module)); +static assert(!is(MyStruct == module)); + +static assert(!is(imports.nonexistent == package)); +static assert(!is(imports.nonexistent == module)); diff --git a/gcc/testsuite/gdc.test/compilable/test16525.d b/gcc/testsuite/gdc.test/compilable/test16525.d index 6c85e0c..e4ce7ef 100644 --- a/gcc/testsuite/gdc.test/compilable/test16525.d +++ b/gcc/testsuite/gdc.test/compilable/test16525.d @@ -12,8 +12,8 @@ extern(C++) struct CPP void test() { - pragma(msg, templ!(D.memvar)); - pragma(msg, templ!(CPP.memvar)); - // root cause, C++ member variables have no mangling - pragma(msg, CPP.memvar.mangleof); + static assert(templ!(D.memvar) == 1234); + static assert(templ!(CPP.memvar) == 1234); + // ICE: root cause, C++ member variables have no mangling + enum CPPmemvar = CPP.memvar.mangleof; } diff --git a/gcc/testsuite/gdc.test/compilable/test17143.d b/gcc/testsuite/gdc.test/compilable/test17143.d index 403c9aa..98e31f4 100644 --- a/gcc/testsuite/gdc.test/compilable/test17143.d +++ b/gcc/testsuite/gdc.test/compilable/test17143.d @@ -1,4 +1,4 @@ import std.typecons : tuple; enum foo = tuple(1, 2).expand; -pragma(msg, typeof(foo).stringof); -pragma(msg, foo.stringof); +static assert(typeof(foo).stringof == "(int, int)"); +static assert(foo.stringof == "tuple(1, 2)"); diff --git a/gcc/testsuite/gdc.test/compilable/test17791.d b/gcc/testsuite/gdc.test/compilable/test17791.d new file mode 100644 index 0000000..cfd0244 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test17791.d @@ -0,0 +1,23 @@ +// REQUIRED_ARGS: -de +deprecated("A deprecated class") { +class DepClass +{ +} +} + +class NewClass +{ +} + +void main() +{ + // test that a symbol (which is not likely to be deprecated) + // is not depercated + static assert(!__traits(isDeprecated, int)); + // check that a class marked deprecated "isDeprecated" + static assert(__traits(isDeprecated, DepClass)); + // check that a class not marked deprecated is not deprecated + static assert(!__traits(isDeprecated, NewClass)); + // Check for expressions (18617) + static assert(__traits(isDeprecated, { scope foo = new DepClass; })); +} diff --git a/gcc/testsuite/gdc.test/compilable/test17908.d b/gcc/testsuite/gdc.test/compilable/test17908.d new file mode 100644 index 0000000..3520b5f --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test17908.d @@ -0,0 +1,17 @@ +// PERMUTE ARGS: + +@disable void foo() {} +void foo(int) {} +alias g = foo; + +// make sure the order of declaration +// doesn't change anything +void bar(int) {} +@disable void bar() {} +alias h = bar; + +void main() +{ + g(10); + h(10); +} diff --git a/gcc/testsuite/gdc.test/compilable/test17991.d b/gcc/testsuite/gdc.test/compilable/test17991.d new file mode 100644 index 0000000..8bc9fa9 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test17991.d @@ -0,0 +1,3 @@ +// https://issues.dlang.org/show_bug.cgi?id=17991 +// EXTRA_FILES: imports/test17991a/package.d imports/test17991a/a.d +import imports.test17991a, imports.test17991a.a; diff --git a/gcc/testsuite/gdc.test/compilable/test19145.d b/gcc/testsuite/gdc.test/compilable/test19145.d new file mode 100644 index 0000000..ef5faa8 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test19145.d @@ -0,0 +1,14 @@ +// https://issues.dlang.org/show_bug.cgi?id=19415 + +struct S +{ + int x; + S foo() return { return S(x); } + this(this) @disable; +} + +S bar() +{ + S s; + return s; // Error: struct `S` is not copyable because it is annotated with @disable +} diff --git a/gcc/testsuite/gdc.test/compilable/test19292.d b/gcc/testsuite/gdc.test/compilable/test19292.d new file mode 100644 index 0000000..8122851 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test19292.d @@ -0,0 +1,15 @@ +// https://issues.dlang.org/show_bug.cgi?id=19292 + +mixin("enum a = ", 87, ";"); +static assert(a == 87); + +int test() +{ + mixin("enum x = ", 7, ";"); + return mixin("1", x, 2U); +} + +void testit() +{ + static assert(test() == 172); +} diff --git a/gcc/testsuite/gdc.test/compilable/test20151a.d b/gcc/testsuite/gdc.test/compilable/test20151a.d new file mode 100644 index 0000000..d9ae28f --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20151a.d @@ -0,0 +1,3 @@ +// EXTRA_FILES: imports/test20151a/b/c/c.d +module imports.test20151a; +import imports.test20151a.b.c.c; diff --git a/gcc/testsuite/gdc.test/compilable/test20280.d b/gcc/testsuite/gdc.test/compilable/test20280.d new file mode 100644 index 0000000..76a1082 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20280.d @@ -0,0 +1,8 @@ +// PERMUTE_ARGS: +// REQUIRED_ARGS: -Icompilable/extra-files +// EXTRA_FILES: extra-files/test20280a.d +module test20280; + +import test20280a; + +alias Charlie = Foxtrot!(0); diff --git a/gcc/testsuite/gdc.test/compilable/test20530.d b/gcc/testsuite/gdc.test/compilable/test20530.d new file mode 100644 index 0000000..be80dbb --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20530.d @@ -0,0 +1,46 @@ +// EXTRA_FILES: imports/test20530a.d imports/plainpackage/plainmodule.d imports/pkgmodule/package.d imports/pkgmodule/plainmodule.d +module mod; +static assert(is(mod == module)); +static assert(is(mixin("mod") == module)); +static assert(!is(mod == package)); +static assert(!is(mixin("mod") == package)); + +import imports.test20530a; +static assert(is(imports == package)); +static assert(is(mixin("imports") == package)); +static assert(!is(imports == module)); +static assert(!is(mixin("imports") == module)); + +import imports.plainpackage.plainmodule; +import imports.pkgmodule.plainmodule; + +struct MyStruct; + +alias a = mixin("imports.plainpackage"); +alias b = mixin("imports.pkgmodule.plainmodule"); + +static assert(is(mixin("imports.plainpackage") == package)); +static assert(is(mixin("a") == package)); +static assert(!is(mixin("imports.plainpackage.plainmodule") == package)); +static assert(!is(mixin("b") == package)); +static assert(is(mixin("imports.pkgmodule") == package)); +mixin("static assert(is(imports.pkgmodule == package));"); + +static assert(!is(mixin("MyStruct") == package)); + +static assert(!is(mixin("imports.plainpackage") == module)); +static assert(!is(mixin("a") == module)); +static assert(is(mixin("imports.plainpackage.plainmodule") == module)); +static assert(is(mixin("b") == module)); +static assert(is(mixin("imports.pkgmodule") == module)); +mixin("static assert(is(imports.pkgmodule == module));"); + +static assert(!is(mixin("MyStruct") == module)); + +static assert(!is(mixin("imports.nonexistent") == package)); +static assert(!is(mixin("imports.nonexistent") == module)); + +// this won't work due to mixin argument .stringof expansion, +// it will expand to mixin(package imports.pkgmodule). Issue 20519. +//static assert(is(mixin(imports.pkgmodule) == package)); +//static assert(is(mixin(imports.pkgmodule) == module)); diff --git a/gcc/testsuite/gdc.test/compilable/test20537.d b/gcc/testsuite/gdc.test/compilable/test20537.d new file mode 100644 index 0000000..f2d05d2 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20537.d @@ -0,0 +1,10 @@ +// REQUIRED_ARGS: -Icompilable/imports +// EXTRA_FILES: imports/pkg20537/package.d +import pkg20537; + +static assert(is(pkg20537 == module)); +static assert(__traits(isModule, pkg20537)); +static assert(is(mixin("pkg20537") == module)); +static assert(is(pkg20537 == package)); +static assert(__traits(isPackage, pkg20537)); +static assert(is(mixin("pkg20537") == package)); diff --git a/gcc/testsuite/gdc.test/compilable/test20692.d b/gcc/testsuite/gdc.test/compilable/test20692.d new file mode 100644 index 0000000..2d67211 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20692.d @@ -0,0 +1,18 @@ +// https://issues.dlang.org/show_bug.cgi?id=20692 + +struct S() { + void fun() { + gun(""); + } + void gun(T)(T) { + alias buggy = bug; + } +} + +alias X = S!(); + +void main() { + X().gun(0); +} + +alias bug = __traits(getMember, X, "fun"); diff --git a/gcc/testsuite/gdc.test/compilable/test20894.d b/gcc/testsuite/gdc.test/compilable/test20894.d new file mode 100644 index 0000000..e8dad45 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20894.d @@ -0,0 +1,46 @@ +// https://issues.dlang.org/show_bug.cgi?id=20894 + +mixin template MT() +{ + int a; + alias b = char; + void c() {} +} + +struct S +{ + mixin MT mt; +} + +void main() +{ + auto r = S(); + enum c = S(); + + foo!(S.mt); + foo!(r.mt); + foo!(c.mt); // OK <- ICE + + foo!(mixin("S.mt")); + foo!(mixin("r.mt")); // OK <- ICE + foo!(mixin("c.mt")); // OK <- ICE + + // some checks + foo!(r.mt, c.mt); + foo!(mixin("r.mt"), c.mt); + foo!(r.mt, mixin("c.mt")); + foo!(S.mt, mixin("c.mt")); +} + +alias Tup(T...) = T; + +void foo(A...)() +{ + static if (A.length == 2) + { + static assert(__traits(isSame, A[0], A[1])); + enum members = __traits(allMembers, A[0]); + static assert(members == __traits(allMembers, A[1])); + static assert(members == Tup!("a", "b", "c")); + } +} diff --git a/gcc/testsuite/gdc.test/compilable/test21501a.d b/gcc/testsuite/gdc.test/compilable/test21501a.d new file mode 100644 index 0000000..096fd51 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test21501a.d @@ -0,0 +1,19 @@ +// EXTRA_SOURCES: imports/test21501b.d imports/test21501c.d +// https://issues.dlang.org/show_bug.cgi?id=21501 + +module test21501a; +import imports.test21501b; +import imports.test21501c; + +alias Identity(alias T) = T; + +struct A +{ + alias a = imports.test21501c.C; + const int b = imports.test21501c.D; // fixed + alias c = Identity!(mixin(q{imports.test21501c.C})); // fixed + const int d = Identity!(mixin(q{imports.test21501c.D})); // fixed + + static assert(is(a == c) && is(a == int)); + static assert(b == d && b == 1); +} diff --git a/gcc/testsuite/gdc.test/compilable/test21742.d b/gcc/testsuite/gdc.test/compilable/test21742.d new file mode 100644 index 0000000..b8f5df4b --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test21742.d @@ -0,0 +1,13 @@ +// https://issues.dlang.org/show_bug.cgi?id=21742 + +int foo()() { return 0; } + +struct B +{ + int foo()() { return 0; } +} + +static assert(is(typeof(foo) == void)); + +// failed, gagged error: expression B().foo()() has no type +static assert(is(typeof(B().foo) == void)); diff --git a/gcc/testsuite/gdc.test/compilable/test21812.d b/gcc/testsuite/gdc.test/compilable/test21812.d new file mode 100644 index 0000000..9cf33f5 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test21812.d @@ -0,0 +1,10 @@ +// https://issues.dlang.org/show_bug.cgi?id=21812 + +struct S(A...) +{ + A args; +} + +static assert(__traits(allMembers, S!(int, float)) == AliasSeq!("args")); + +alias AliasSeq(T...) = T; diff --git a/gcc/testsuite/gdc.test/compilable/test21898.d b/gcc/testsuite/gdc.test/compilable/test21898.d new file mode 100644 index 0000000..9ac18b8 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test21898.d @@ -0,0 +1,7 @@ +// https://issues.dlang.org/show_bug.cgi?id=21898 + +alias Works(T) = immutable(T); +alias Fails(T) = immutable T; + +static assert(is(Works!int == immutable int)); +static assert(is(Fails!int == immutable int)); diff --git a/gcc/testsuite/gdc.test/compilable/test22006.d b/gcc/testsuite/gdc.test/compilable/test22006.d new file mode 100644 index 0000000..913dd85 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test22006.d @@ -0,0 +1,14 @@ +// https://issues.dlang.org/show_bug.cgi?id=22006 +void test22006() +{ + alias AliasSeq(TList...) = TList; + { + alias aseq = AliasSeq!(0, 1, 2, 3); + static foreach (ubyte i; 0 .. aseq.length) {} + static foreach (ubyte i, x; aseq) {} + } + { + static foreach (ubyte i; 0 .. [0, 1, 2, 3].length) {} + static foreach (ubyte i, x; [0, 1, 2, 3]) {} + } +} diff --git a/gcc/testsuite/gdc.test/compilable/test22133.d b/gcc/testsuite/gdc.test/compilable/test22133.d new file mode 100644 index 0000000..aff762c --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test22133.d @@ -0,0 +1,16 @@ +// https://issues.dlang.org/show_bug.cgi?id=22133 + +struct Slice +{ + bool empty() const; + int front() const; + void popFront()() // note: requires a mutable Slice + {} +} + +enum isInputRange1(R) = is(typeof((R r) => r.popFront)); +enum isInputRange2(R) = __traits(compiles, (R r) => r.popFront); +static assert(isInputRange1!( Slice) == true); +static assert(isInputRange1!(const Slice) == false); +static assert(isInputRange2!( Slice) == true); +static assert(isInputRange2!(const Slice) == false); diff --git a/gcc/testsuite/gdc.test/compilable/test7815.d b/gcc/testsuite/gdc.test/compilable/test7815.d index 405d9fc..631c020 100644 --- a/gcc/testsuite/gdc.test/compilable/test7815.d +++ b/gcc/testsuite/gdc.test/compilable/test7815.d @@ -1,10 +1,4 @@ // REQUIRED_ARGS: -o- -/* -TEST_OUTPUT: ---- ---- -*/ - mixin template Helpers() { static if (is(Flags!Move)) diff --git a/gcc/testsuite/gdc.test/compilable/test9029.d b/gcc/testsuite/gdc.test/compilable/test9029.d new file mode 100644 index 0000000..bbbd98a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test9029.d @@ -0,0 +1,39 @@ +// https://issues.dlang.org/show_bug.cgi?id=9029 +enum NameOf(alias S) = S.stringof; + +static assert(NameOf!int == "int"); + +enum BothMatch(alias S) = "alias"; +enum BothMatch(T) = "type"; + +void foo9029() { } + +struct Struct { } + +static assert(BothMatch!int == "type"); +static assert(BothMatch!(void function()) == "type"); +static assert(BothMatch!BothMatch == "alias"); +static assert(BothMatch!Struct == "type"); +static assert(BothMatch!foo9029 == "alias"); +static assert(BothMatch!5 == "alias"); + +// https://issues.dlang.org/show_bug.cgi?id=19884 +mixin template genCtEvaluate() +{ + void evaluate(alias op)() { } +} +struct S +{ + mixin genCtEvaluate!() mixinEval; + alias evaluate = mixinEval.evaluate; + void evaluate() { } +} +alias List(Ops...) = Ops; +void main() +{ + S g; + foreach (op; List!(0)) + { + g.evaluate!op(); + } +} diff --git a/gcc/testsuite/gdc.test/compilable/test9701.d b/gcc/testsuite/gdc.test/compilable/test9701.d new file mode 100644 index 0000000..8f822ad --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test9701.d @@ -0,0 +1,58 @@ +// https://issues.dlang.org/show_bug.cgi?id=9701 + +template AliasSeq(TList...) +{ + alias AliasSeq = TList; +} + +enum +{ + uda4, + uda5, + uda6, + uda8, + uda9 +} + +enum Enum +{ + value0, + @("uda1") value1, + @("uda2", "uda3", 42) value2, + @uda4 value3, + @uda5 @uda6 value4, + @("uda7") @uda8 value5, + @uda9 @("uda10") value6, + deprecated value7, + deprecated("message") value8, +} + +@("uda0") +enum +{ + value0, + @("uda1") value1, + @("uda2") @("uda3") value2, + @uda4 value3, + @uda5 @uda6 value4, + @("uda7") @uda8 value5, + @uda9 @("uda10") value6 +} + +static assert(__traits(getAttributes, Enum.value0).length == 0); +static assert(__traits(getAttributes, Enum.value1) == AliasSeq!("uda1")); +static assert(__traits(getAttributes, Enum.value2) == AliasSeq!("uda2", "uda3", 42)); +static assert(__traits(getAttributes, Enum.value3) == AliasSeq!(uda4)); +static assert(__traits(getAttributes, Enum.value4) == AliasSeq!(uda5, uda6)); +static assert(__traits(getAttributes, Enum.value5) == AliasSeq!("uda7", uda8)); +static assert(__traits(getAttributes, Enum.value6) == AliasSeq!(uda9, "uda10")); +static assert(__traits(isDeprecated, Enum.value7)); +static assert(__traits(isDeprecated, Enum.value8)); + +static assert(__traits(getAttributes, value0) == AliasSeq!("uda0")); +static assert(__traits(getAttributes, value1) == AliasSeq!("uda0", "uda1")); +static assert(__traits(getAttributes, value2) == AliasSeq!("uda0", "uda2", "uda3")); +static assert(__traits(getAttributes, value3) == AliasSeq!("uda0", uda4)); +static assert(__traits(getAttributes, value4) == AliasSeq!("uda0", uda5, uda6)); +static assert(__traits(getAttributes, value5) == AliasSeq!("uda0", "uda7", uda8)); +static assert(__traits(getAttributes, value6) == AliasSeq!("uda0", uda9, "uda10")); diff --git a/gcc/testsuite/gdc.test/compilable/testDIP37.d b/gcc/testsuite/gdc.test/compilable/testDIP37.d index 7188758..38bce38 100644 --- a/gcc/testsuite/gdc.test/compilable/testDIP37.d +++ b/gcc/testsuite/gdc.test/compilable/testDIP37.d @@ -34,7 +34,6 @@ void test7() static import pkgDIP37.datetime; static assert(!__traits(compiles, def())); pkgDIP37.datetime.def(); - pkgDIP37.datetime.common.def(); } // https://issues.dlang.org/show_bug.cgi?id=17629 diff --git a/gcc/testsuite/gdc.test/compilable/testInference.d b/gcc/testsuite/gdc.test/compilable/testInference.d index 5a8e1e2..3248f3e 100644 --- a/gcc/testsuite/gdc.test/compilable/testInference.d +++ b/gcc/testsuite/gdc.test/compilable/testInference.d @@ -653,7 +653,7 @@ void foo10296()() void bar()() { a[1] = 2; } bar(); - pragma(msg, typeof(bar!())); // nothrow @safe void() + static assert(typeof(bar!()).stringof == "pure nothrow @nogc @safe void()"); // nothrow @safe void() } pure void test10296() { @@ -811,7 +811,7 @@ void test13840() nothrow func13840(); // throwable function call } } - catch + catch(Throwable) {} } diff --git a/gcc/testsuite/gdc.test/compilable/testcheckimports.d b/gcc/testsuite/gdc.test/compilable/testcheckimports.d index 328b8a9..ee9764a 100644 --- a/gcc/testsuite/gdc.test/compilable/testcheckimports.d +++ b/gcc/testsuite/gdc.test/compilable/testcheckimports.d @@ -1,9 +1,5 @@ -// REQUIRED_ARGS: -transition=checkimports -de -/* -TEST_OUTPUT: ---- ---- -*/ +// REQUIRED_ARGS: +// EXTRA_FILES: imports/test15857a.d imports/test15857b.d imports/test15857c.d // https://issues.dlang.org/show_bug.cgi?id=15825 diff --git a/gcc/testsuite/gdc.test/compilable/testheader1.d b/gcc/testsuite/gdc.test/compilable/testheader1.d index c46728d..256a1fe 100644 --- a/gcc/testsuite/gdc.test/compilable/testheader1.d +++ b/gcc/testsuite/gdc.test/compilable/testheader1.d @@ -1,6 +1,12 @@ // EXTRA_SOURCES: extra-files/header1.d // REQUIRED_ARGS: -o- -unittest -H -Hf${RESULTS_DIR}/compilable/header1.di // PERMUTE_ARGS: -d -dw -// POST_SCRIPT: compilable/extra-files/header-postscript.sh header1 +// POST_SCRIPT: compilable/extra-files/header-postscript.sh +/* +TEST_OUTPUT: +--- +Hello World +--- +*/ void main() {} diff --git a/gcc/testsuite/gdc.test/compilable/testheader1i.d b/gcc/testsuite/gdc.test/compilable/testheader1i.d index 9859992..0eca3c4 100644 --- a/gcc/testsuite/gdc.test/compilable/testheader1i.d +++ b/gcc/testsuite/gdc.test/compilable/testheader1i.d @@ -1,6 +1,12 @@ // EXTRA_SOURCES: extra-files/header1.d // REQUIRED_ARGS: -o- -H -Hf${RESULTS_DIR}/compilable/header1i.di -inline // PERMUTE_ARGS: -d -dw -// POST_SCRIPT: compilable/extra-files/header-postscript.sh header1i +// POST_SCRIPT: compilable/extra-files/header-postscript.sh +/* +TEST_OUTPUT: +--- +Hello World +--- +*/ void main() {} diff --git a/gcc/testsuite/gdc.test/compilable/testheaderudamodule.d b/gcc/testsuite/gdc.test/compilable/testheaderudamodule.d index 1a7d650..5ee9486 100644 --- a/gcc/testsuite/gdc.test/compilable/testheaderudamodule.d +++ b/gcc/testsuite/gdc.test/compilable/testheaderudamodule.d @@ -11,3 +11,5 @@ struct UDA } void main() {} + +void foo(@(1) int bar, @UDA(2) string bebe); diff --git a/gcc/testsuite/gdc.test/compilable/testparse.d b/gcc/testsuite/gdc.test/compilable/testparse.d index d6713ad..f514146 100644 --- a/gcc/testsuite/gdc.test/compilable/testparse.d +++ b/gcc/testsuite/gdc.test/compilable/testparse.d @@ -4,7 +4,7 @@ /***************************************************/ // 6719 -pragma(msg, __traits(compiles, mixin("(const(A))[0..0]"))); +static assert(__traits(compiles, mixin("(const(A))[0..0]")) == false); /***************************************************/ // 9232 diff --git a/gcc/testsuite/gdc.test/compilable/traits.d b/gcc/testsuite/gdc.test/compilable/traits.d index 736eae4..4d8a5e1 100644 --- a/gcc/testsuite/gdc.test/compilable/traits.d +++ b/gcc/testsuite/gdc.test/compilable/traits.d @@ -1,10 +1,140 @@ // REQUIRED_ARGS: +// EXTRA_FILES: imports/plainpackage/plainmodule.d imports/pkgmodule/package.d imports/pkgmodule/plainmodule.d // This file is intended to contain all compilable traits-related tests in an // effort to keep the number of files in the `compilable` folder to a minimum. +// https://issues.dlang.org/show_bug.cgi?id=19152 +module traits; + +class C19152 +{ + int OnExecute() + { + auto name = __traits(getOverloads, this, "OnExecute").stringof; + return 0; + } +} + +static assert(is(typeof(__traits(getTargetInfo, "cppRuntimeLibrary")) == string)); +version (CppRuntime_Microsoft) +{ + static assert(__traits(getTargetInfo, "cppRuntimeLibrary") == "libcmt"); +} + +import imports.plainpackage.plainmodule; +import imports.pkgmodule.plainmodule; + +#line 40 +struct MyStruct; + +alias a = imports.plainpackage; +alias b = imports.pkgmodule.plainmodule; + +static assert(__traits(isPackage, imports.plainpackage)); +static assert(__traits(isPackage, a)); +static assert(!__traits(isPackage, imports.plainpackage.plainmodule)); +static assert(!__traits(isPackage, b)); +static assert(__traits(isPackage, imports.pkgmodule)); +static assert(!__traits(isPackage, MyStruct)); + +static assert(!__traits(isModule, imports.plainpackage)); +static assert(!__traits(isModule, a)); +static assert(__traits(isModule, imports.plainpackage.plainmodule)); +static assert(__traits(isModule, b)); +// This is supposed to work even though we haven't directly imported imports.pkgmodule. +static assert(__traits(isModule, imports.pkgmodule)); +static assert(!__traits(isModule, MyStruct)); + /******************************************/ // https://issues.dlang.org/show_bug.cgi?id=19942 static assert(!__traits(compiles, { a.init; })); static assert(!__traits(compiles, { import m : a; a.init; })); + +version(Windows) + static assert(__traits(getLocation, MyStruct)[0] == `compilable\traits.d`); +else + static assert(__traits(getLocation, MyStruct)[0] == "compilable/traits.d"); +static assert(__traits(getLocation, MyStruct)[1] == 40); +static assert(__traits(getLocation, MyStruct)[2] == 1); + +int foo(); +int foo(int); + +static assert(__traits(getLocation, __traits(getOverloads, traits, "foo")[1])[1] == 74); + +mixin("int bar;"); +static assert(__traits(getLocation, bar)[1] == 78); + +struct Outer +{ + struct Nested{} + + void method() {} +} +static assert(__traits(getLocation, Outer.Nested)[1] == 83); +static assert(__traits(getLocation, Outer.method)[1] == 85); + +/******************************************/ +// https://issues.dlang.org/show_bug.cgi?id=19902 +// Define hasElaborateCopyConstructor trait +// but done as two independent traits per conversation +// in https://github.com/dlang/dmd/pull/10265 + +struct S +{ + this (ref S rhs) {} +} + +struct OuterS +{ + struct S + { + this (ref S rhs) {} + } + + S s; +} + +void foo(T)() +{ + struct S(U) + { + this (ref S rhs) {} + } +} + +struct U(T) +{ + this (ref U rhs) {} +} + +struct SPostblit +{ + this(this) {} +} + +struct DisabledPostblit +{ + @disable this(this); +} + +struct NoCpCtor { } +class C19902 { } + +static assert(__traits(compiles, foo!int)); +static assert(__traits(compiles, foo!S)); +static assert(!__traits(hasPostblit, U!S)); +static assert(__traits(hasPostblit, SPostblit)); + +static assert(!__traits(hasPostblit, NoCpCtor)); +static assert(!__traits(hasPostblit, C19902)); +static assert(!__traits(hasPostblit, int)); + +// Check that invalid use cases don't compile +static assert(!__traits(compiles, __traits(hasPostblit))); +static assert(!__traits(compiles, __traits(hasPostblit, S()))); + +static assert(__traits(isCopyable, int)); +static assert(!__traits(isCopyable, DisabledPostblit)); diff --git a/gcc/testsuite/gdc.test/compilable/vcg-ast.d b/gcc/testsuite/gdc.test/compilable/vcg-ast.d new file mode 100644 index 0000000..7cc376f --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/vcg-ast.d @@ -0,0 +1,43 @@ +module vcg; +// REQUIRED_ARGS: -vcg-ast -o- +// PERMUTE_ARGS: + +template Seq(A...) +{ + alias Seq = A; +} + +auto a = Seq!(1,2,3); + + +template R(T) +{ + struct _R { T elem; } +} + +typeof(R!int._R.elem) x; + + +static foreach(enum i; 0..3) +{ + mixin("int a" ~ i.stringof ~ " = 1;"); +} + +void foo() +{ + static foreach(enum i; 0..3) + { + mixin("int a" ~ i.stringof ~ " = 1;"); + } +} + +class C +{ + invariant {} + invariant (true); + + int foo() in{} out{} out(r){} in(true) out(; true) out(r; true) + { + return 2; + } +} diff --git a/gcc/testsuite/gdc.test/compilable/warn3882.d b/gcc/testsuite/gdc.test/compilable/warn3882.d index bf824b8..d981a47 100644 --- a/gcc/testsuite/gdc.test/compilable/warn3882.d +++ b/gcc/testsuite/gdc.test/compilable/warn3882.d @@ -1,10 +1,4 @@ // PERMUTE_ARGS: -w -wi -debug -/* -TEST_OUTPUT: ---- ---- -*/ - @safe pure nothrow void strictVoidReturn(T)(T x) {} @safe pure nothrow void nonstrictVoidReturn(T)(ref T x) {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/b12504.d b/gcc/testsuite/gdc.test/fail_compilation/b12504.d new file mode 100644 index 0000000..0bb104e --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/b12504.d @@ -0,0 +1,64 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/b12504.d(26): Error: cannot implicitly convert expression `257$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ubyte` +fail_compilation/b12504.d(27): Error: index type `ubyte` cannot cover index range 0..257 +fail_compilation/b12504.d(31): Error: cannot implicitly convert expression `129$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `byte` +fail_compilation/b12504.d(32): Error: index type `byte` cannot cover index range 0..129 +fail_compilation/b12504.d(36): Error: cannot implicitly convert expression `65537$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ushort` +fail_compilation/b12504.d(37): Error: index type `ushort` cannot cover index range 0..65537 +fail_compilation/b12504.d(41): Error: cannot implicitly convert expression `32769$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `short` +fail_compilation/b12504.d(42): Error: index type `short` cannot cover index range 0..32769 +fail_compilation/b12504.d(46): Error: cannot implicitly convert expression `257$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ubyte` +fail_compilation/b12504.d(47): Error: index type `ubyte` cannot cover index range 0..257 +fail_compilation/b12504.d(51): Error: cannot implicitly convert expression `129$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `byte` +fail_compilation/b12504.d(52): Error: index type `byte` cannot cover index range 0..129 +fail_compilation/b12504.d(56): Error: cannot implicitly convert expression `65537$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ushort` +fail_compilation/b12504.d(57): Error: index type `ushort` cannot cover index range 0..65537 +fail_compilation/b12504.d(61): Error: cannot implicitly convert expression `32769$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `short` +fail_compilation/b12504.d(62): Error: index type `short` cannot cover index range 0..32769 +--- +*/ +void main() +{ + { + int[0xFF + 2] sta; + foreach (ubyte i; 0 .. sta.length) {} + foreach (ubyte i, x; sta) {} + } + { + int[0x7F + 2] sta; + foreach (byte i; 0 .. sta.length) {} + foreach (byte i, x; sta) {} + } + { + int[0xFFFF + 2] sta; + foreach (ushort i; 0 .. sta.length) {} + foreach (ushort i, x; sta) {} + } + { + int[0x7FFF + 2] sta; + foreach (short i; 0 .. sta.length) {} + foreach (short i, x; sta) {} + } + { + immutable int[0xFF + 2] sta; + static foreach (ubyte i; 0 .. sta.length) {} + static foreach (ubyte i, x; sta) {} + } + { + immutable int[0x7F + 2] sta; + static foreach (byte i; 0 .. sta.length) {} + static foreach (byte i, x; sta) {} + } + { + immutable int[0xFFFF + 2] sta; + static foreach (ushort i; 0 .. sta.length) {} + static foreach (ushort i, x; sta) {} + } + { + immutable int[0x7FFF + 2] sta; + static foreach (short i; 0 .. sta.length) {} + static foreach (short i, x; sta) {} + } +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug15613.d b/gcc/testsuite/gdc.test/fail_compilation/bug15613.d new file mode 100644 index 0000000..e8072fd --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/bug15613.d @@ -0,0 +1,18 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/bug15613.d(16): Error: function `bug15613.f(int...)` is not callable using argument types `(typeof(null))` +fail_compilation/bug15613.d(16): cannot pass argument `null` of type `typeof(null)` to parameter `int...` +fail_compilation/bug15613.d(17): Error: function `bug15613.g(Object, ...)` is not callable using argument types `(int)` +fail_compilation/bug15613.d(17): cannot pass argument `8` of type `int` to parameter `Object` +--- +*/ + +void f(int...); +void g(Object, ...); + +void main() +{ + f(null); + g(8); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug16165.d b/gcc/testsuite/gdc.test/fail_compilation/bug16165.d new file mode 100644 index 0000000..fdfbf73 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/bug16165.d @@ -0,0 +1,18 @@ +void f(int x, Object y); + +void g() +{ + Object o; + f(o, o, 404); + f(5, 6, 404); +} + +/* +TEST_OUTPUT: +--- +fail_compilation/bug16165.d(6): Error: function `bug16165.f(int x, Object y)` is not callable using argument types `(Object, Object, int)` +fail_compilation/bug16165.d(6): cannot pass argument `o` of type `object.Object` to parameter `int x` +fail_compilation/bug16165.d(7): Error: function `bug16165.f(int x, Object y)` is not callable using argument types `(int, int, int)` +fail_compilation/bug16165.d(7): cannot pass argument `6` of type `int` to parameter `Object y` +--- + */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug5.d b/gcc/testsuite/gdc.test/fail_compilation/bug5.d index 7878af7..b2f7d1d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/bug5.d +++ b/gcc/testsuite/gdc.test/fail_compilation/bug5.d @@ -1,4 +1,9 @@ -// REQUIRED_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/bug5.d(8): Error: function `bug5.test1` no `return exp;` or `assert(0);` at end of function +--- +*/ int test1() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug5b.d b/gcc/testsuite/gdc.test/fail_compilation/bug5b.d index ca7ddd9..8ba5717 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/bug5b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/bug5b.d @@ -1,4 +1,9 @@ -// REQUIRED_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/bug5b.d(8): Error: function `bug5b.test1` has no `return` statement, but is expected to return a value of type `int` +--- +*/ int test1() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug8150a.d b/gcc/testsuite/gdc.test/fail_compilation/bug8150a.d index 906b73c..a03f850 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/bug8150a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/bug8150a.d @@ -1,4 +1,11 @@ -// Bugzilla 8150: nothrow check doesn't work for constructor +// https://issues.dlang.org/show_bug.cgi?id=8150: nothrow check doesn't work for constructor +/* +TEST_OUTPUT: +--- +fail_compilation/bug8150a.d(14): Error: `object.Exception` is thrown but not caught +fail_compilation/bug8150a.d(12): Error: `nothrow` constructor `bug8150a.Foo.this` may throw +--- +*/ struct Foo { diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug8150b.d b/gcc/testsuite/gdc.test/fail_compilation/bug8150b.d index b861aee..2091bc8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/bug8150b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/bug8150b.d @@ -1,4 +1,12 @@ -// Bugzilla 8150: nothrow check doesn't work for constructor +// https://issues.dlang.org/show_bug.cgi?id=8150: nothrow check doesn't work for constructor +/* +TEST_OUTPUT: +--- +fail_compilation/bug8150b.d(15): Error: `object.Exception` is thrown but not caught +fail_compilation/bug8150b.d(13): Error: `nothrow` constructor `bug8150b.Foo.__ctor!().this` may throw +fail_compilation/bug8150b.d(20): Error: template instance `bug8150b.Foo.__ctor!()` error instantiating +--- +*/ struct Foo { diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug9631.d b/gcc/testsuite/gdc.test/fail_compilation/bug9631.d new file mode 100644 index 0000000..852eaae --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/bug9631.d @@ -0,0 +1,100 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/bug9631.d(20): Error: cannot implicitly convert expression `F()` of type `bug9631.T1!().F` to `bug9631.T2!().F` +--- +*/ + +template T1() +{ + struct F { } +} + +template T2() +{ + struct F { } +} + +void main() +{ + T2!().F x = T1!().F(); +} + +/* +TEST_OUTPUT: +--- +fail_compilation/bug9631.d(41): Error: incompatible types for ((x) == (y)): 'bug9631.S' and 'bug9631.tem! +).S' +--- +*/ + +struct S { char c; } + +template tem() +{ + struct S { int i; } +} + +void equal() +{ + S x; + auto y = tem!().S(); + bool b = x == y; +} + +/* +TEST_OUTPUT: +--- +fail_compilation/bug9631.d(79): Error: function `bug9631.arg.f(int i, S s)` is not callable using argumen + types `(int, S)` +fail_compilation/bug9631.d(79): cannot pass argument `y` of type `bug9631.tem!().S` to parameter ` +ug9631.S s` +fail_compilation/bug9631.d(80): Error: function literal `__lambda2(S s)` is not callable using argument t +pes `(S)` +fail_compilation/bug9631.d(80): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631 +tem!().S s` +fail_compilation/bug9631.d(86): Error: constructor `bug9631.arg.A.this(S _param_0)` is not callable using +argument types `(S)` +fail_compilation/bug9631.d(86): cannot pass argument `S(0)` of type `bug9631.tem!().S` to paramete + `bug9631.S _param_0` +--- +*/ +void arg() +{ + S x; + tem!().S y; + + void f(int i, S s); + f(4, y); + (tem!().S s){}(x); + + struct A + { + this(S){} + } + A(tem!().S()); +} + +/* +TEST_OUTPUT: +--- +fail_compilation/bug9631.d(106): Error: function `bug9631.targ.ft!().ft(S _param_0)` is not callable using argument types `(S)` +fail_compilation/bug9631.d(106): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631.tem!().S _param_0` +fail_compilation/bug9631.d(107): Error: template `bug9631.targ.ft` cannot deduce function from argument types `!()(S)`, candidates are: +fail_compilation/bug9631.d(105): `bug9631.targ.ft()(tem!().S)` +fail_compilation/bug9631.d(109): Error: template `bug9631.targ.ft2` cannot deduce function from argument types `!()(S, int)`, candidates are: +fail_compilation/bug9631.d(108): `bug9631.targ.ft2(T)(S, T)` +--- +*/ +void targ() +{ + S x; + tem!().S y; + + void ft()(tem!().S){} + ft!()(x); + ft(x); + void ft2(T)(S, T){} + ft2(y, 1); +} + diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports1a.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports1a.d deleted file mode 100644 index a27ddea..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports1a.d +++ /dev/null @@ -1,20 +0,0 @@ -// REQUIRED_ARGS: -transition=checkimports -de -/* -TEST_OUTPUT: ---- -fail_compilation/checkimports1a.d(16): Deprecation: local import search method found struct imports.diag12598a.lines instead of variable checkimports1a.C.lines ---- -*/ - - -// new lookup + information -class C -{ - void f() - { - import imports.diag12598a; - lines ~= ""; - } - - string[] lines; -} diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports1b.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports1b.d deleted file mode 100644 index 60d3ae8..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports1b.d +++ /dev/null @@ -1,20 +0,0 @@ -// REQUIRED_ARGS: -transition=import -transition=checkimports -/* -TEST_OUTPUT: ---- -fail_compilation/checkimports1b.d(16): Deprecation: local import search method found struct imports.diag12598a.lines instead of variable checkimports1b.C.lines -fail_compilation/checkimports1b.d(16): Error: struct 'lines' is a type, not an lvalue ---- -*/ - -// old lookup + information -class C -{ - void f() - { - import imports.diag12598a; - lines ~= ""; - } - - string[] lines; -} diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports1c.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports1c.d deleted file mode 100644 index f6587ef..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports1c.d +++ /dev/null @@ -1,20 +0,0 @@ -// REQUIRED_ARGS: -transition=checkimports -transition=import -/* -TEST_OUTPUT: ---- -fail_compilation/checkimports1c.d(16): Deprecation: local import search method found struct imports.diag12598a.lines instead of variable checkimports1c.C.lines -fail_compilation/checkimports1c.d(16): Error: struct 'lines' is a type, not an lvalue ---- -*/ - -// old lookup + information (the order of switches is reverse) -class C -{ - void f() - { - import imports.diag12598a; - lines ~= ""; - } - - string[] lines; -} diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d index 567a308..abec424 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d @@ -1,16 +1,11 @@ -// REQUIRED_ARGS: -transition=checkimports +// REQUIRED_ARGS: /* TEST_OUTPUT: --- -fail_compilation/checkimports2a.d(26): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2a.X -fail_compilation/checkimports2a.d(32): Deprecation: local import search method found variable imports.imp2.X instead of nothing -fail_compilation/checkimports2a.d(32): Error: no property 'X' for type 'checkimports2a.B' -fail_compilation/checkimports2a.d(32): while evaluating: `static assert((B).X == 0)` -fail_compilation/checkimports2a.d(33): Deprecation: local import search method found variable imports.imp2.Y instead of nothing -fail_compilation/checkimports2a.d(33): Error: no property 'Y' for type 'checkimports2a.B' -fail_compilation/checkimports2a.d(33): while evaluating: `static assert((B).Y == 2)` -fail_compilation/checkimports2a.d(35): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2a.X -fail_compilation/checkimports2a.d(36): Deprecation: local import search method found variable imports.imp2.Y instead of variable imports.imp1.Y +fail_compilation/checkimports2a.d(27): Error: no property `X` for type `checkimports2a.B`, did you mean `imports.imp2.X`? +fail_compilation/checkimports2a.d(27): while evaluating: `static assert((B).X == 0)` +fail_compilation/checkimports2a.d(28): Error: no property `Y` for type `checkimports2a.B`, did you mean `imports.imp2.Y`? +fail_compilation/checkimports2a.d(28): while evaluating: `static assert((B).Y == 2)` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d index 4f52521..8b99fdc 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d @@ -1,17 +1,8 @@ -// REQUIRED_ARGS: -transition=import -transition=checkimports -de +// REQUIRED_ARGS: /* TEST_OUTPUT: --- -fail_compilation/checkimports2b.d(27): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2b.X -fail_compilation/checkimports2b.d(27): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2b.d(33): Deprecation: local import search method found variable imports.imp2.X instead of nothing -fail_compilation/checkimports2b.d(33): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2b.d(34): Deprecation: local import search method found variable imports.imp2.Y instead of nothing -fail_compilation/checkimports2b.d(34): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2b.d(36): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2b.X -fail_compilation/checkimports2b.d(36): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2b.d(37): Deprecation: local import search method found variable imports.imp2.Y instead of variable imports.imp1.Y -fail_compilation/checkimports2b.d(37): while evaluating: `static assert(2 == 2)` +fail_compilation/checkimports2b.d(18): Error: static assert: `0 == 2` is false --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d index f56da9c..4208dcdf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d +++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d @@ -1,18 +1,8 @@ -// REQUIRED_ARGS: -transition=checkimports -transition=import -de +// REQUIRED_ARGS: /* TEST_OUTPUT: --- - -fail_compilation/checkimports2c.d(28): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2c.X -fail_compilation/checkimports2c.d(28): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2c.d(34): Deprecation: local import search method found variable imports.imp2.X instead of nothing -fail_compilation/checkimports2c.d(34): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2c.d(35): Deprecation: local import search method found variable imports.imp2.Y instead of nothing -fail_compilation/checkimports2c.d(35): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2c.d(37): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2c.X -fail_compilation/checkimports2c.d(37): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2c.d(38): Deprecation: local import search method found variable imports.imp2.Y instead of variable imports.imp1.Y -fail_compilation/checkimports2c.d(38): while evaluating: `static assert(2 == 2)` +fail_compilation/checkimports2c.d(18): Error: static assert: `0 == 2` is false --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports3.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports3.d deleted file mode 100644 index e9d44a7..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports3.d +++ /dev/null @@ -1,15 +0,0 @@ -/* -REQUIRED_ARGS: -transition=checkimports -de -TEST_OUTPUT: ---- -fail_compilation/checkimports3.d(14): Deprecation: local import search method found overloadset checkimports3.foo (3 overloads) instead of overloadset checkimports3.foo (2 overloads) ---- -*/ -import imports.checkimports3a; -import imports.checkimports3b; -import imports.checkimports3c; - -void test() -{ - foo(); -} diff --git a/gcc/testsuite/gdc.test/fail_compilation/chkformat.d b/gcc/testsuite/gdc.test/fail_compilation/chkformat.d new file mode 100644 index 0000000..e9ed241 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/chkformat.d @@ -0,0 +1,171 @@ +/* +REQUIRED_ARGS: -de +TEST_OUTPUT: +--- +fail_compilation/chkformat.d(101): Deprecation: width argument `0L` for format specification `"%*.*d"` must be `int`, not `long` +fail_compilation/chkformat.d(101): Deprecation: precision argument `1L` for format specification `"%*.*d"` must be `int`, not `long` +fail_compilation/chkformat.d(101): Deprecation: argument `2L` for format specification `"%*.*d"` must be `int`, not `long` +fail_compilation/chkformat.d(104): Deprecation: argument `4` for format specification `"%lld"` must be `long`, not `int` +fail_compilation/chkformat.d(105): Deprecation: argument `5` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t`, not `int` +fail_compilation/chkformat.d(106): Deprecation: argument `6.0` for format specification `"%zd"` must be `size_t`, not `double` +fail_compilation/chkformat.d(107): Deprecation: argument `7.0` for format specification `"%td"` must be `ptrdiff_t`, not `double` +fail_compilation/chkformat.d(108): Deprecation: argument `8.0L` for format specification `"%g"` must be `double`, not `real` +fail_compilation/chkformat.d(109): Deprecation: argument `9.0` for format specification `"%Lg"` must be `real`, not `double` +fail_compilation/chkformat.d(110): Deprecation: argument `10` for format specification `"%p"` must be `void*`, not `int` +fail_compilation/chkformat.d(111): Deprecation: argument `& u` for format specification `"%n"` must be `int*`, not `uint*` +fail_compilation/chkformat.d(113): Deprecation: argument `& u` for format specification `"%lln"` must be `long*`, not `int*` +fail_compilation/chkformat.d(114): Deprecation: argument `& u` for format specification `"%hn"` must be `short*`, not `int*` +fail_compilation/chkformat.d(115): Deprecation: argument `& u` for format specification `"%hhn"` must be `byte*`, not `int*` +fail_compilation/chkformat.d(116): Deprecation: argument `16L` for format specification `"%c"` must be `char`, not `long` +fail_compilation/chkformat.d(117): Deprecation: argument `17L` for format specification `"%c"` must be `char`, not `long` +fail_compilation/chkformat.d(118): Deprecation: argument `& u` for format specification `"%s"` must be `char*`, not `int*` +fail_compilation/chkformat.d(119): Deprecation: argument `& u` for format specification `"%ls"` must be `wchar_t*`, not `int*` +fail_compilation/chkformat.d(201): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` +fail_compilation/chkformat.d(202): Deprecation: more format specifiers than 1 arguments +fail_compilation/chkformat.d(203): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` +fail_compilation/chkformat.d(204): Deprecation: argument `0L` for format specification `"%3u"` must be `uint*`, not `long` +fail_compilation/chkformat.d(205): Deprecation: argument `u` for format specification `"%200u"` must be `uint*`, not `uint` +fail_compilation/chkformat.d(206): Deprecation: argument `3.0` for format specification `"%hhd"` must be `byte*`, not `double` +fail_compilation/chkformat.d(207): Deprecation: argument `4` for format specification `"%hd"` must be `short*`, not `int` +fail_compilation/chkformat.d(209): Deprecation: argument `4` for format specification `"%lld"` must be `long*`, not `int` +fail_compilation/chkformat.d(210): Deprecation: argument `5` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t*`, not `int` +fail_compilation/chkformat.d(211): Deprecation: argument `6.0` for format specification `"%zd"` must be `size_t*`, not `double` +fail_compilation/chkformat.d(212): Deprecation: argument `7.0` for format specification `"%td"` must be `ptrdiff_t*`, not `double` +fail_compilation/chkformat.d(213): Deprecation: format specifier `"%Ld"` is invalid +fail_compilation/chkformat.d(214): Deprecation: argument `0` for format specification `"%u"` must be `uint*`, not `int` +fail_compilation/chkformat.d(215): Deprecation: argument `0` for format specification `"%hhu"` must be `ubyte*`, not `int` +fail_compilation/chkformat.d(216): Deprecation: argument `0` for format specification `"%hu"` must be `ushort*`, not `int` +fail_compilation/chkformat.d(218): Deprecation: argument `0` for format specification `"%llu"` must be `ulong*`, not `int` +fail_compilation/chkformat.d(219): Deprecation: argument `0` for format specification `"%ju"` must be `core.stdc.stdint.uintmax_t*`, not `int` +fail_compilation/chkformat.d(220): Deprecation: argument `0` for format specification `"%zu"` must be `size_t*`, not `int` +fail_compilation/chkformat.d(221): Deprecation: argument `0` for format specification `"%tu"` must be `ptrdiff_t*`, not `int` +fail_compilation/chkformat.d(222): Deprecation: argument `8.0L` for format specification `"%g"` must be `float*`, not `real` +fail_compilation/chkformat.d(223): Deprecation: argument `8.0L` for format specification `"%lg"` must be `double*`, not `real` +fail_compilation/chkformat.d(224): Deprecation: argument `9.0` for format specification `"%Lg"` must be `real*`, not `double` +fail_compilation/chkformat.d(225): Deprecation: argument `& u` for format specification `"%s"` must be `char*`, not `int*` +fail_compilation/chkformat.d(226): Deprecation: argument `& u` for format specification `"%ls"` must be `wchar_t*`, not `int*` +fail_compilation/chkformat.d(227): Deprecation: argument `v` for format specification `"%p"` must be `void**`, not `void*` +fail_compilation/chkformat.d(228): Deprecation: argument `& u` for format specification `"%n"` must be `int*`, not `ushort*` +fail_compilation/chkformat.d(229): Deprecation: argument `& u` for format specification `"%hhn"` must be `byte*`, not `int*` +fail_compilation/chkformat.d(230): Deprecation: format specifier `"%[n"` is invalid +fail_compilation/chkformat.d(231): Deprecation: format specifier `"%]"` is invalid +fail_compilation/chkformat.d(232): Deprecation: argument `& u` for format specification `"%90s"` must be `char*`, not `int*` +fail_compilation/chkformat.d(233): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` +fail_compilation/chkformat.d(234): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` +--- +*/ + + +import core.stdc.stdio; + +#line 100 + +void test1() { printf("%*.*d\n", 0L, 1L, 2L); } +//void test2() { } +//void test3() { printf("%ld\n", 3.0); } +void test4() { printf("%lld\n", 4); } +void test5() { printf("%jd\n", 5); } +void test6() { printf("%zd\n", 6.0); } +void test7() { printf("%td\n", 7.0); } +void test8() { printf("%g\n", 8.0L); } +void test9() { printf("%Lg\n", 9.0); } +void test10() { printf("%p\n", 10); } +void test11() { uint u; printf("%n\n", &u); } +//void test12() { ushort u; printf("%ln\n", &u); } +void test13() { int u; printf("%lln\n", &u); } +void test14() { int u; printf("%hn\n", &u); } +void test15() { int u; printf("%hhn\n", &u); } +void test16() { printf("%c\n", 16L); } +void test17() { printf("%c\n", 17L); } +void test18() { int u; printf("%s\n", &u); } +void test19() { int u; printf("%ls\n", &u); } +//void test20() { int u; char[] s; sprintf(&s[0], "%d\n", &u); } +//void test21() { int u; fprintf(null, "%d\n", &u); } + +#line 200 + +void test31() { scanf("%d\n", 0L); } +void test32() { int i; scanf("%d %d\n", &i); } +void test33() { scanf("%d%*c\n", 0L); } +void test34() { scanf("%3u\n", 0L); } +void test35() { uint u; scanf("%200u%*s\n", u); } +void test36() { scanf("%hhd\n", 3.0); } +void test37() { scanf("%hd\n", 4); } +//void test38() { scanf("%ld\n", 3.0); } +void test39() { scanf("%lld\n", 4); } +void test40() { scanf("%jd\n", 5); } +void test41() { scanf("%zd\n", 6.0); } +void test42() { scanf("%td\n", 7.0); } +void test43() { scanf("%Ld\n", 0); } +void test44() { scanf("%u\n", 0); } +void test45() { scanf("%hhu\n", 0); } +void test46() { scanf("%hu\n", 0); } +//void test47() { scanf("%lu\n", 0); } +void test48() { scanf("%llu\n", 0); } +void test49() { scanf("%ju\n", 0); } +void test50() { scanf("%zu\n", 0); } +void test51() { scanf("%tu\n", 0); } +void test52() { scanf("%g\n", 8.0L); } +void test53() { scanf("%lg\n", 8.0L); } +void test54() { scanf("%Lg\n", 9.0); } +void test55() { int u; scanf("%s\n", &u); } +void test56() { int u; scanf("%ls\n", &u); } +void test57() { void* v; scanf("%p\n", v); } +void test58() { ushort u; scanf("%n\n", &u); } +void test59() { int u; scanf("%hhn\n", &u); } +void test60() { int u; scanf("%[n", &u); } +void test61() { int u; scanf("%]\n", &u); } +void test62() { int u; scanf("%90s\n", &u); } +void test63() { sscanf("1234", "%d\n", 0L); } +void test64() { fscanf(null, "%d\n", 0L); } + +/* TEST_OUTPUT: +--- +fail_compilation/chkformat.d(301): Deprecation: format specifier `"%K"` is invalid +fail_compilation/chkformat.d(302): Deprecation: format specifier `"%Q"` is invalid +--- +*/ + +import core.stdc.stdarg; + +#line 300 + +void test301() { va_list vargs; vprintf("%K", vargs); } +void test302() { va_list vargs; vscanf("%Q", vargs); } + +// TODO - C++ 11 only: +//void test() { vscanf(); } +//void test() { vfscanf(); } +//void test() { vsscanf(); } + +/* TEST_OUTPUT: +--- +fail_compilation/chkformat.d(401): Deprecation: argument `p` for format specification `"%u"` must be `uint`, not `char*` +fail_compilation/chkformat.d(402): Deprecation: argument `p` for format specification `"%d"` must be `int`, not `char*` +fail_compilation/chkformat.d(403): Deprecation: argument `p` for format specification `"%hhu"` must be `ubyte`, not `char*` +fail_compilation/chkformat.d(404): Deprecation: argument `p` for format specification `"%hhd"` must be `byte`, not `char*` +fail_compilation/chkformat.d(405): Deprecation: argument `p` for format specification `"%hu"` must be `ushort`, not `char*` +fail_compilation/chkformat.d(406): Deprecation: argument `p` for format specification `"%hd"` must be `short`, not `char*` +fail_compilation/chkformat.d(407): Deprecation: argument `p` for format specification `"%lu"` must be `$?:windows=uint|32=uint|64=ulong$`, not `char*` +fail_compilation/chkformat.d(408): Deprecation: argument `p` for format specification `"%ld"` must be `$?:windows=int|32=int|64=long$`, not `char*` +fail_compilation/chkformat.d(409): Deprecation: argument `p` for format specification `"%llu"` must be `ulong`, not `char*` +fail_compilation/chkformat.d(410): Deprecation: argument `p` for format specification `"%lld"` must be `long`, not `char*` +fail_compilation/chkformat.d(411): Deprecation: argument `p` for format specification `"%ju"` must be `core.stdc.stdint.uintmax_t`, not `char*` +fail_compilation/chkformat.d(412): Deprecation: argument `p` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t`, not `char*` +--- +*/ + +#line 400 + +void test401() { char* p; printf("%u", p); } +void test402() { char* p; printf("%d", p); } +void test403() { char* p; printf("%hhu", p); } +void test404() { char* p; printf("%hhd", p); } +void test405() { char* p; printf("%hu", p); } +void test406() { char* p; printf("%hd", p); } +void test407() { char* p; printf("%lu", p); } +void test408() { char* p; printf("%ld", p); } +void test409() { char* p; printf("%llu", p); } +void test410() { char* p; printf("%lld", p); } +void test411() { char* p; printf("%ju", p); } +void test412() { char* p; printf("%jd", p); } diff --git a/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d b/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d index b8b2f03..ca9ed9a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d +++ b/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/cppmangle.d(10): Error: invalid zero length C++ namespace -fail_compilation/cppmangle.d(14): Error: expected valid identifer for C++ namespace but got `0num` +fail_compilation/cppmangle.d(14): Error: expected valid identifier for C++ namespace but got `0num` fail_compilation/cppmangle.d(18): Error: string expected following `,` for C++ namespace, not `)` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10169.d b/gcc/testsuite/gdc.test/fail_compilation/diag10169.d index 2a9714d..3c35b66 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag10169.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag10169.d @@ -1,8 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/diag10169.d(12): Deprecation: imports.a10169.B.x is not visible from module diag10169 -fail_compilation/diag10169.d(12): Error: struct imports.a10169.B member `x` is not accessible +fail_compilation/diag10169.d(11): Error: no property `x` for type `B`, did you mean `imports.a10169.B.x`? --- */ import imports.a10169; diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10327.d b/gcc/testsuite/gdc.test/fail_compilation/diag10327.d index 1d163c7..38f9ccb 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag10327.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag10327.d @@ -1 +1,11 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/diag10327.d(11): Error: module `test10327` is in file 'imports/test10327.d' which cannot be read +import path[0] = fail_compilation +import path[1] = $p:druntime/import$ +import path[2] = $p:phobos$ +--- +*/ + import imports.test10327; // package.d missing diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d b/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d index 2280691..a5d6a14 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d @@ -14,7 +14,7 @@ fail_compilation/diag11819b.d(37): Error: unrecognized trait `AllMembers`, did y fail_compilation/diag11819b.d(38): Error: unrecognized trait `DerivedMembers`, did you mean `derivedMembers`? fail_compilation/diag11819b.d(39): Error: unrecognized trait `IsSame`, did you mean `isSame`? fail_compilation/diag11819b.d(40): Error: unrecognized trait `Compiles`, did you mean `compiles`? -fail_compilation/diag11819b.d(41): Error: unrecognized trait `Parameters`, did you mean `parameters`? +fail_compilation/diag11819b.d(41): Error: unrecognized trait `Parameters` fail_compilation/diag11819b.d(42): Error: unrecognized trait `GetAliasThis`, did you mean `getAliasThis`? fail_compilation/diag11819b.d(43): Error: unrecognized trait `GetAttributes`, did you mean `getAttributes`? fail_compilation/diag11819b.d(44): Error: unrecognized trait `GetFunctionAttributes`, did you mean `getFunctionAttributes`? diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13082.d b/gcc/testsuite/gdc.test/fail_compilation/diag13082.d index 13259ce..7360a3df6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag13082.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag13082.d @@ -1,8 +1,10 @@ /* TEST_OUTPUT: --- -fail_compilation/diag13082.d(22): Error: constructor diag13082.C.this (int a) is not callable using argument types (string) -fail_compilation/diag13082.d(23): Error: constructor diag13082.S.this (int a) is not callable using argument types (string) +fail_compilation/diag13082.d(24): Error: constructor `diag13082.C.this(int a)` is not callable using argument types `(string)` +fail_compilation/diag13082.d(24): cannot pass argument `b` of type `string` to parameter `int a` +fail_compilation/diag13082.d(25): Error: constructor `diag13082.S.this(int a)` is not callable using argument types `(string)` +fail_compilation/diag13082.d(25): cannot pass argument `b` of type `string` to parameter `int a` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag15713.d b/gcc/testsuite/gdc.test/fail_compilation/diag15713.d index 14f2d84..a7714c9 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag15713.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag15713.d @@ -1,4 +1,5 @@ /* +TEST_OUTPUT: --- fail_compilation/diag15713.d(18): Error: no property 'widthSign' for type 'Data' fail_compilation/diag15713.d(38): Error: template instance test.conwritefImpl!("parse-int", "width", "\x0a", Data()) error instantiating diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag16271.d b/gcc/testsuite/gdc.test/fail_compilation/diag16271.d new file mode 100644 index 0000000..b85dc8d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/diag16271.d @@ -0,0 +1,12 @@ +/* +TEST_OUTPUT +--- +fail_compilation/diag16271.d(10): Error: found `x` when expecting function literal following `ref` +--- +*/ + +void main() +{ + auto fun = ref x; +} + diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag16976.d b/gcc/testsuite/gdc.test/fail_compilation/diag16976.d index ebfb72b..1dbacfd 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag16976.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag16976.d @@ -1,21 +1,37 @@ /* TEST_OUTPUT: --- -fail_compilation/diag16976.d(28): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(29): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(30): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(31): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(32): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(33): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(34): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(35): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(36): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(37): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(38): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(39): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(40): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(41): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(42): Error: foreach: key cannot be of non-integral type `float` -fail_compilation/diag16976.d(43): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(44): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(45): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(46): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(47): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(48): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(49): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(50): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(51): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(52): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(53): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(54): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(55): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(56): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(57): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(58): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(59): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(65): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(66): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(67): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(68): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(69): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(70): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(71): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(72): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(73): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(74): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(75): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(76): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(77): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(78): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(79): Error: foreach: key cannot be of non-integral type `float` +fail_compilation/diag16976.d(80): Error: foreach: key cannot be of non-integral type `float` --- */ @@ -41,4 +57,25 @@ void main() foreach_reverse(float f, dchar i; sta) {} foreach_reverse(float f, dchar i; str) {} foreach_reverse(float f, dchar i; chr) {} + + immutable int[] idyn = [1,2,3,4,5]; + immutable int[5] ista = [1,2,3,4,5]; + immutable char[] istr = ['1','2','3','4','5']; + immutable char[5] ichr = ['1','2','3','4','5']; + static foreach(float f, i; idyn) {} + static foreach(float f, i; ista) {} + static foreach(float f, i; istr) {} + static foreach(float f, i; ichr) {} + static foreach(float f, dchar i; idyn) {} + static foreach(float f, dchar i; ista) {} + static foreach(float f, dchar i; istr) {} + static foreach(float f, dchar i; ichr) {} + static foreach_reverse(float f, i; idyn) {} + static foreach_reverse(float f, i; ista) {} + static foreach_reverse(float f, i; istr) {} + static foreach_reverse(float f, i; ichr) {} + static foreach_reverse(float f, dchar i; idyn) {} + static foreach_reverse(float f, dchar i; ista) {} + static foreach_reverse(float f, dchar i; istr) {} + static foreach_reverse(float f, dchar i; ichr) {} } diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag19196.d b/gcc/testsuite/gdc.test/fail_compilation/diag19196.d new file mode 100644 index 0000000..857f9a4 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/diag19196.d @@ -0,0 +1,16 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/diag19196.d(11): Error: unable to determine fields of `B` because of forward references +fail_compilation/diag19196.d(15): Error: template instance `diag19196.Foo!(B)` error instantiating +--- +*/ +module diag19196; +struct Foo(T) +{ + alias F = typeof(T.tupleof); +} +struct B +{ + Foo!B b; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag5385.d b/gcc/testsuite/gdc.test/fail_compilation/diag5385.d index 131659c..7c81b16 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag5385.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag5385.d @@ -1,22 +1,14 @@ /* TEST_OUTPUT: --- -fail_compilation/diag5385.d(27): Deprecation: imports.fail5385.C.privX is not visible from module diag5385 -fail_compilation/diag5385.d(27): Error: class imports.fail5385.C member `privX` is not accessible -fail_compilation/diag5385.d(28): Deprecation: imports.fail5385.C.packX is not visible from module diag5385 -fail_compilation/diag5385.d(28): Error: class imports.fail5385.C member `packX` is not accessible -fail_compilation/diag5385.d(29): Deprecation: imports.fail5385.C.privX2 is not visible from module diag5385 -fail_compilation/diag5385.d(29): Error: class imports.fail5385.C member `privX2` is not accessible -fail_compilation/diag5385.d(30): Deprecation: imports.fail5385.C.packX2 is not visible from module diag5385 -fail_compilation/diag5385.d(30): Error: class imports.fail5385.C member `packX2` is not accessible -fail_compilation/diag5385.d(31): Deprecation: imports.fail5385.S.privX is not visible from module diag5385 -fail_compilation/diag5385.d(31): Error: struct imports.fail5385.S member `privX` is not accessible -fail_compilation/diag5385.d(32): Deprecation: imports.fail5385.S.packX is not visible from module diag5385 -fail_compilation/diag5385.d(32): Error: struct imports.fail5385.S member `packX` is not accessible -fail_compilation/diag5385.d(33): Deprecation: imports.fail5385.S.privX2 is not visible from module diag5385 -fail_compilation/diag5385.d(33): Error: struct imports.fail5385.S member `privX2` is not accessible -fail_compilation/diag5385.d(34): Deprecation: imports.fail5385.S.packX2 is not visible from module diag5385 -fail_compilation/diag5385.d(34): Error: struct imports.fail5385.S member `packX2` is not accessible +fail_compilation/diag5385.d(19): Error: no property `privX` for type `imports.fail5385.C`, did you mean `imports.fail5385.C.privX`? +fail_compilation/diag5385.d(20): Error: no property `packX` for type `imports.fail5385.C`, did you mean `imports.fail5385.C.packX`? +fail_compilation/diag5385.d(21): Error: no property `privX2` for type `imports.fail5385.C`, did you mean `imports.fail5385.C.privX2`? +fail_compilation/diag5385.d(22): Error: no property `packX2` for type `imports.fail5385.C`, did you mean `imports.fail5385.C.packX2`? +fail_compilation/diag5385.d(23): Error: no property `privX` for type `S`, did you mean `imports.fail5385.S.privX`? +fail_compilation/diag5385.d(24): Error: no property `packX` for type `S`, did you mean `imports.fail5385.S.packX`? +fail_compilation/diag5385.d(25): Error: no property `privX2` for type `S`, did you mean `imports.fail5385.S.privX2`? +fail_compilation/diag5385.d(26): Error: no property `packX2` for type `S`, did you mean `imports.fail5385.S.packX2`? --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8101.d b/gcc/testsuite/gdc.test/fail_compilation/diag8101.d index 6fc3809..3b2401a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag8101.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag8101.d @@ -1,29 +1,30 @@ /* TEST_OUTPUT: --- -fail_compilation/diag8101.d(56): Error: function diag8101.f_0 (int) is not callable using argument types () -fail_compilation/diag8101.d(57): Error: none of the overloads of 'f_1' are callable using argument types (), candidates are: -fail_compilation/diag8101.d(32): diag8101.f_1(int) -fail_compilation/diag8101.d(33): diag8101.f_1(int, int) -fail_compilation/diag8101.d(58): Error: none of the overloads of 'f_2' are callable using argument types (), candidates are: -fail_compilation/diag8101.d(35): diag8101.f_2(int) -fail_compilation/diag8101.d(36): diag8101.f_2(int, int) -fail_compilation/diag8101.d(37): diag8101.f_2(int, int, int) -fail_compilation/diag8101.d(38): diag8101.f_2(int, int, int, int) -fail_compilation/diag8101.d(39): diag8101.f_2(int, int, int, int, int) -fail_compilation/diag8101.d(58): ... (1 more, -v to show) ... -fail_compilation/diag8101.d(60): Error: template diag8101.t_0 cannot deduce function from argument types !()(), candidates are: -fail_compilation/diag8101.d(42): diag8101.t_0(T1)() -fail_compilation/diag8101.d(61): Error: template diag8101.t_1 cannot deduce function from argument types !()(), candidates are: -fail_compilation/diag8101.d(44): diag8101.t_1(T1)() -fail_compilation/diag8101.d(45): diag8101.t_1(T1, T2)() -fail_compilation/diag8101.d(62): Error: template diag8101.t_2 cannot deduce function from argument types !()(), candidates are: -fail_compilation/diag8101.d(47): diag8101.t_2(T1)() -fail_compilation/diag8101.d(48): diag8101.t_2(T1, T2)() -fail_compilation/diag8101.d(49): diag8101.t_2(T1, T2, T3)() -fail_compilation/diag8101.d(50): diag8101.t_2(T1, T2, T3, T4)() -fail_compilation/diag8101.d(51): diag8101.t_2(T1, T2, T3, T4, T5)() -fail_compilation/diag8101.d(62): ... (1 more, -v to show) ... +fail_compilation/diag8101.d(57): Error: function `diag8101.f_0(int)` is not callable using argument types `()` +fail_compilation/diag8101.d(57): missing argument for parameter #1: `int` +fail_compilation/diag8101.d(58): Error: none of the overloads of `f_1` are callable using argument types `()`, candidates are: +fail_compilation/diag8101.d(33): `diag8101.f_1(int)` +fail_compilation/diag8101.d(34): `diag8101.f_1(int, int)` +fail_compilation/diag8101.d(59): Error: none of the overloads of `f_2` are callable using argument types `()`, candidates are: +fail_compilation/diag8101.d(36): `diag8101.f_2(int)` +fail_compilation/diag8101.d(37): `diag8101.f_2(int, int)` +fail_compilation/diag8101.d(38): `diag8101.f_2(int, int, int)` +fail_compilation/diag8101.d(39): `diag8101.f_2(int, int, int, int)` +fail_compilation/diag8101.d(40): `diag8101.f_2(int, int, int, int, int)` +fail_compilation/diag8101.d(59): ... (1 more, -v to show) ... +fail_compilation/diag8101.d(61): Error: template `diag8101.t_0` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/diag8101.d(43): `diag8101.t_0(T1)()` +fail_compilation/diag8101.d(62): Error: template `diag8101.t_1` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/diag8101.d(45): `diag8101.t_1(T1)()` +fail_compilation/diag8101.d(46): `diag8101.t_1(T1, T2)()` +fail_compilation/diag8101.d(63): Error: template `diag8101.t_2` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/diag8101.d(48): `diag8101.t_2(T1)()` +fail_compilation/diag8101.d(49): `diag8101.t_2(T1, T2)()` +fail_compilation/diag8101.d(50): `diag8101.t_2(T1, T2, T3)()` +fail_compilation/diag8101.d(51): `diag8101.t_2(T1, T2, T3, T4)()` +fail_compilation/diag8101.d(52): `diag8101.t_2(T1, T2, T3, T4, T5)()` +fail_compilation/diag8101.d(63): ... (1 more, -v to show) ... --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d b/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d index a3baa27..228ba16 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d @@ -1,14 +1,15 @@ /* TEST_OUTPUT: --- -fail_compilation/diag8101b.d(26): Error: none of the overloads of 'foo' are callable using argument types (double), candidates are: -fail_compilation/diag8101b.d(17): diag8101b.S.foo(int _param_0) -fail_compilation/diag8101b.d(18): diag8101b.S.foo(int _param_0, int _param_1) -fail_compilation/diag8101b.d(28): Error: function diag8101b.S.bar (int _param_0) is not callable using argument types (double) -fail_compilation/diag8101b.d(31): Error: none of the overloads of 'foo' are callable using a const object, candidates are: -fail_compilation/diag8101b.d(17): diag8101b.S.foo(int _param_0) -fail_compilation/diag8101b.d(18): diag8101b.S.foo(int _param_0, int _param_1) -fail_compilation/diag8101b.d(33): Error: mutable method diag8101b.S.bar is not callable using a const object +fail_compilation/diag8101b.d(27): Error: none of the overloads of `foo` are callable using argument types `(double)`, candidates are: +fail_compilation/diag8101b.d(18): `diag8101b.S.foo(int _param_0)` +fail_compilation/diag8101b.d(19): `diag8101b.S.foo(int _param_0, int _param_1)` +fail_compilation/diag8101b.d(29): Error: function `diag8101b.S.bar(int _param_0)` is not callable using argument types `(double)` +fail_compilation/diag8101b.d(29): cannot pass argument `1.00000` of type `double` to parameter `int _param_0` +fail_compilation/diag8101b.d(32): Error: none of the overloads of `foo` are callable using a `const` object, candidates are: +fail_compilation/diag8101b.d(18): `diag8101b.S.foo(int _param_0)` +fail_compilation/diag8101b.d(19): `diag8101b.S.foo(int _param_0, int _param_1)` +fail_compilation/diag8101b.d(34): Error: mutable method `diag8101b.S.bar` is not callable using a `const` object --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9420.d b/gcc/testsuite/gdc.test/fail_compilation/diag9420.d index dfaf7c8..6b2577d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag9420.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag9420.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT --- -fail_compilation/diag9420.d(20): Error: function diag9420.S.t3!().tx () is not callable using argument types (int) +fail_compilation/diag9420.d(21): Error: function `diag9420.S.t3!().tx()` is not callable using argument types `(int)` +fail_compilation/diag9420.d(21): expected 0 argument(s), not 1 --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22a.d b/gcc/testsuite/gdc.test/fail_compilation/dip22a.d index 7497b42..5bd2b5b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/dip22a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/dip22a.d @@ -1,17 +1,12 @@ /* -REQUIRED_ARGS: -de +REQUIRED_ARGS: TEST_OUTPUT: --- -fail_compilation/dip22a.d(21): Deprecation: imports.dip22a.Klass.bar is not visible from module dip22a -fail_compilation/dip22a.d(21): Error: class imports.dip22a.Klass member `bar` is not accessible -fail_compilation/dip22a.d(22): Deprecation: imports.dip22a.Struct.bar is not visible from module dip22a -fail_compilation/dip22a.d(22): Error: struct imports.dip22a.Struct member `bar` is not accessible -fail_compilation/dip22a.d(23): Error: imports.dip22a.bar is not visible from module dip22a -fail_compilation/dip22a.d(23): Error: function `imports.dip22a.bar` is not accessible from module `dip22a` -fail_compilation/dip22a.d(24): Error: imports.dip22a.Template!int.bar is not visible from module dip22a -fail_compilation/dip22a.d(24): Error: function `imports.dip22a.Template!int.bar` is not accessible from module `dip22a` -fail_compilation/dip22a.d(25): Deprecation: imports.dip22a.bar is not visible from module dip22a -fail_compilation/dip22a.d(25): Error: function `imports.dip22a.bar` is not accessible from module `dip22a` +fail_compilation/dip22a.d(16): Error: no property `bar` for type `imports.dip22a.Klass`, did you mean `imports.dip22a.Klass.bar`? +fail_compilation/dip22a.d(17): Error: no property `bar` for type `Struct`, did you mean `imports.dip22a.Struct.bar`? +fail_compilation/dip22a.d(18): Error: undefined identifier `bar` in module `imports.dip22a`, did you mean function `bar`? +fail_compilation/dip22a.d(19): Error: no property `bar` for type `void` +fail_compilation/dip22a.d(20): Error: no property `bar` for type `int` --- */ import imports.dip22a; diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22b.d b/gcc/testsuite/gdc.test/fail_compilation/dip22b.d index 7aca88c..9520180 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/dip22b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/dip22b.d @@ -1,8 +1,8 @@ /* -REQUIRED_ARGS: -de +REQUIRED_ARGS: TEST_OUTPUT: --- -fail_compilation/dip22b.d(12): Deprecation: pkg.dip22c.Foo is not visible from module dip22 +fail_compilation/dip22b.d(12): Error: undefined identifier `Foo`, did you mean variable `foo`? --- */ module pkg.dip22; diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22d.d b/gcc/testsuite/gdc.test/fail_compilation/dip22d.d deleted file mode 100644 index dd1b8ef..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/dip22d.d +++ /dev/null @@ -1,12 +0,0 @@ -/* -REQUIRED_ARGS: -transition=import -TEST_OUTPUT: ---- -fail_compilation/dip22d.d(12): Error: imports.dip22d.Foo at fail_compilation/imports/dip22d.d(3) conflicts with imports.dip22e.Foo at fail_compilation/imports/dip22e.d(3) -fail_compilation/dip22d.d(12): Error: module dip22d struct imports.dip22d.Foo is private ---- -*/ -import imports.dip22d; -import imports.dip22e; - -Foo foo; diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22e.d b/gcc/testsuite/gdc.test/fail_compilation/dip22e.d index f82d8e7..b1411b2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/dip22e.d +++ b/gcc/testsuite/gdc.test/fail_compilation/dip22e.d @@ -1,10 +1,8 @@ /* -REQUIRED_ARGS: -transition=checkimports -de +REQUIRED_ARGS: TEST_OUTPUT: --- -fail_compilation/dip22e.d(16): Deprecation: imports.dip22d.foo is not visible from module dip22e -fail_compilation/dip22e.d(16): Error: function `imports.dip22d.foo` is not accessible from module `dip22e` -fail_compilation/dip22e.d(17): Deprecation: local import search method found overloadset dip22e.bar (2 overloads) instead of function imports.dip22e.bar +fail_compilation/dip22e.d(14): Error: undefined identifier `foo`, did you mean struct `Foo`? --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/disable.d b/gcc/testsuite/gdc.test/fail_compilation/disable.d index 517fddd..7e7d9c2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/disable.d +++ b/gcc/testsuite/gdc.test/fail_compilation/disable.d @@ -1,15 +1,16 @@ /* TEST_OUTPUT: --- -fail_compilation/disable.d(50): Error: function disable.DisabledOpAssign.opAssign is not callable because it is annotated with @disable -fail_compilation/disable.d(53): Error: function disable.DisabledPostblit.opAssign is not callable because it is annotated with @disable -fail_compilation/disable.d(56): Error: function disable.HasDtor.opAssign is not callable because it is annotated with @disable -fail_compilation/disable.d(60): Error: generated function disable.Nested!(DisabledOpAssign).Nested.opAssign is not callable because it is annotated with @disable -fail_compilation/disable.d(63): Error: generated function disable.Nested!(DisabledPostblit).Nested.opAssign is not callable because it is annotated with @disable -fail_compilation/disable.d(66): Error: generated function disable.Nested!(HasDtor).Nested.opAssign is not callable because it is annotated with @disable -fail_compilation/disable.d(70): Error: generated function disable.NestedDtor!(DisabledOpAssign).NestedDtor.opAssign is not callable because it is annotated with @disable -fail_compilation/disable.d(73): Error: generated function disable.NestedDtor!(DisabledPostblit).NestedDtor.opAssign is not callable because it is annotated with @disable -fail_compilation/disable.d(76): Error: generated function disable.NestedDtor!(HasDtor).NestedDtor.opAssign is not callable because it is annotated with @disable +fail_compilation/disable.d(56): Error: function `disable.DisabledOpAssign.opAssign` cannot be used because it is annotated with `@disable` +fail_compilation/disable.d(59): Error: function `disable.DisabledPostblit.opAssign` cannot be used because it is annotated with `@disable` +fail_compilation/disable.d(62): Error: function `disable.HasDtor.opAssign` cannot be used because it is annotated with `@disable` +fail_compilation/disable.d(66): Error: generated function `disable.Nested!(DisabledOpAssign).Nested.opAssign` cannot be used because it is annotated with `@disable` +fail_compilation/disable.d(69): Error: generated function `disable.Nested!(DisabledPostblit).Nested.opAssign` cannot be used because it is annotated with `@disable` +fail_compilation/disable.d(72): Error: generated function `disable.Nested!(HasDtor).Nested.opAssign` cannot be used because it is annotated with `@disable` +fail_compilation/disable.d(76): Error: generated function `disable.NestedDtor!(DisabledOpAssign).NestedDtor.opAssign` cannot be used because it is annotated with `@disable` +fail_compilation/disable.d(79): Error: generated function `disable.NestedDtor!(DisabledPostblit).NestedDtor.opAssign` cannot be used because it is annotated with `@disable` +fail_compilation/disable.d(82): Error: generated function `disable.NestedDtor!(HasDtor).NestedDtor.opAssign` cannot be used because it is annotated with `@disable` +fail_compilation/disable.d(84): Error: enum member `disable.Enum1.value` cannot be used because it is annotated with `@disable` --- */ struct DisabledOpAssign { @@ -44,6 +45,11 @@ struct NestedDtor (T) ~this() {} } +enum Enum1 +{ + @disable value +} + void main () { DisabledOpAssign o; @@ -74,4 +80,6 @@ void main () NestedDtor!(HasDtor) ndd; ndd = NestedDtor!(HasDtor)(); + + auto v1 = Enum1.value; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/enum_init.d b/gcc/testsuite/gdc.test/fail_compilation/enum_init.d new file mode 100644 index 0000000..ab6ba30 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/enum_init.d @@ -0,0 +1,171 @@ +/* +https://issues.dlang.org/show_bug.cgi?id=8511 + +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(5): Error: type `SQRTMAX` has no value +--- +*/ +#line 1 + +real hypot() +{ + enum SQRTMAX; + SQRTMAX/2; +} + +/* +https://issues.dlang.org/show_bug.cgi?id=21785 + +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(106): Error: enum `enum_init.NoBase` is opaque and has no default initializer +--- +*/ +#line 100 + +enum NoBase; + +void fooNB() +{ + NoBase nbv = void; + NoBase nb; +} + +/* +https://issues.dlang.org/show_bug.cgi?id=21785 + +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(206): Error: enum `enum_init.Xobj` is opaque and has no default initializer +--- +*/ +#line 200 + +enum Xobj : void*; + +void main() +{ + Xobj vv = void; + Xobj var; +} + + +/* +https://issues.dlang.org/show_bug.cgi?id=21785 + +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(306): Error: variable `enum_init.fooOB.ob` no definition of struct `S` +fail_compilation/enum_init.d(302): required by type `OpaqueBase` +--- +*/ +#line 300 + +struct S; +enum OpaqueBase : S; + +void fooOB() +{ + OpaqueBase ob; +} + +/* +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(405): Error: enum `enum_init.forwardRef.Foo` forward reference of `Foo.init` +--- +*/ +#line 400 + +void forwardRef() +{ + enum Foo + { + a = Foo.init + } +} + +/* +https://issues.dlang.org/show_bug.cgi?id=21792 + +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(503): Error: circular reference to enum base type `Bar` +--- +*/ +#line 500 + +void forwardRef2() +{ + enum Bar : Bar + { + a + } +} + +/* +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(606): Error: enum member `enum_init.forwardRef3.Foo.b` is forward referenced looking for `.min` +fail_compilation/enum_init.d(607): Error: enum member `enum_init.forwardRef3.Foo.c` is forward referenced looking for `.min` +--- +*/ +#line 600 + +void forwardRef3() +{ + enum Foo + { + a, + b = Foo.min, + c + } +} + +/* +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(711): Error: circular reference to enum base type `int[Bar.sizeof]` +--- +*/ +#line 700 + +void forwardRef4() +{ + enum Foo + { + a = Foo.sizeof, + c + } + // pragma(msg, typeof(Foo.sizeof)); + // static assert(is(Foo Base == enum) && is(Base == int)); + + enum Bar : int[Bar.sizeof] + { + a + } +} + +/* +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(809): Error: enum `enum_init.opaqueProperties.Foo` is opaque and has no default initializer +fail_compilation/enum_init.d(810): Error: enum `enum_init.opaqueProperties.Foo` is opaque and has no `.min` +fail_compilation/enum_init.d(811): Error: enum `enum_init.opaqueProperties.Foo` is opaque and has no `.max` +--- +*/ +#line 800 + +void opaqueProperties() +{ + enum Foo; + + // Valid + enum size = Foo.sizeof; + enum s = Foo.mangleof; + + Foo f = Foo.init; + int min = Foo.min; + int max = Foo.max; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10207.d b/gcc/testsuite/gdc.test/fail_compilation/fail10207.d index ac8b4ee..3f09a27 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail10207.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail10207.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail10207.d(7): Error: user defined attributes not allowed for `alias` declarations +fail_compilation/fail10207.d(7): Error: user-defined attributes not allowed for `alias` declarations --- */ alias @Safe int __externC; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail104.d b/gcc/testsuite/gdc.test/fail_compilation/fail104.d index 7e455f3..2111844 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail104.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail104.d @@ -1,6 +1,14 @@ // Issue 76 - Using a non-template struct as a template // Compiling leads to "Assertion failure: 's->parent' on line 1694 in file // 'template.c'" +/* +TEST_OUTPUT: +--- +fail_compilation/fail104.d(26): Error: template instance `P!()` `P` is not a template declaration, it is a alias +fail_compilation/fail104.d(26): Error: mixin `fail104.C!(S).C.T!()` is not defined +fail_compilation/fail104.d(31): Error: template instance `fail104.C!(S)` error instantiating +--- +*/ struct S { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10528.d b/gcc/testsuite/gdc.test/fail_compilation/fail10528.d index c05a29a..067e83c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail10528.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail10528.d @@ -1,18 +1,14 @@ /* TEST_OUTPUT: --- -fail_compilation/fail10528.d(23): Error: module fail10528 variable a10528.a is private -fail_compilation/fail10528.d(23): Deprecation: a10528.a is not visible from module fail10528 -fail_compilation/fail10528.d(24): Error: a10528.a is not visible from module fail10528 -fail_compilation/fail10528.d(26): Error: module fail10528 enum member a10528.b is private -fail_compilation/fail10528.d(26): Deprecation: a10528.b is not visible from module fail10528 -fail_compilation/fail10528.d(27): Error: a10528.b is not visible from module fail10528 -fail_compilation/fail10528.d(29): Deprecation: a10528.S.c is not visible from module fail10528 -fail_compilation/fail10528.d(29): Error: variable `a10528.S.c` is not accessible from module `fail10528` -fail_compilation/fail10528.d(30): Error: variable `a10528.S.c` is not accessible from module `fail10528` -fail_compilation/fail10528.d(32): Deprecation: a10528.C.d is not visible from module fail10528 -fail_compilation/fail10528.d(32): Error: variable `a10528.C.d` is not accessible from module `fail10528` -fail_compilation/fail10528.d(33): Error: variable `a10528.C.d` is not accessible from module `fail10528` +fail_compilation/fail10528.d(19): Error: undefined identifier `a` +fail_compilation/fail10528.d(20): Error: undefined identifier `a` in module `a10528`, did you mean variable `a`? +fail_compilation/fail10528.d(22): Error: undefined identifier `b` +fail_compilation/fail10528.d(23): Error: undefined identifier `b` in module `a10528`, did you mean enum member `b`? +fail_compilation/fail10528.d(25): Error: no property `c` for type `S`, did you mean `a10528.S.c`? +fail_compilation/fail10528.d(26): Error: no property `c` for type `S`, did you mean `a10528.S.c`? +fail_compilation/fail10528.d(28): Error: no property `d` for type `a10528.C`, did you mean `a10528.C.d`? +fail_compilation/fail10528.d(29): Error: no property `d` for type `a10528.C`, did you mean `a10528.C.d`? --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail109.d b/gcc/testsuite/gdc.test/fail_compilation/fail109.d index 4fd5321..3e379c3 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail109.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail109.d @@ -53,10 +53,10 @@ enum B /* Bugzilla 11849 TEST_OUTPUT: --- -fail_compilation/fail109.d(72): Error: enum fail109.RegValueType1a recursive definition of `.max` property -fail_compilation/fail109.d(79): Error: enum fail109.RegValueType1b recursive definition of `.max` property -fail_compilation/fail109.d(84): Error: enum fail109.RegValueType2a recursive definition of `.min` property -fail_compilation/fail109.d(91): Error: enum fail109.RegValueType2b recursive definition of `.min` property +fail_compilation/fail109.d(72): Error: enum member `fail109.RegValueType1a.Unknown` is forward referenced looking for `.max` +fail_compilation/fail109.d(79): Error: enum member `fail109.RegValueType1b.Unknown` is forward referenced looking for `.max` +fail_compilation/fail109.d(84): Error: enum member `fail109.RegValueType2a.Unknown` is forward referenced looking for `.min` +fail_compilation/fail109.d(91): Error: enum member `fail109.RegValueType2b.Unknown` is forward referenced looking for `.min` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10905.d b/gcc/testsuite/gdc.test/fail_compilation/fail10905.d index 2028648..6181d94 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail10905.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail10905.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail10905.d(20): Error: incompatible types for `(this.x) == (cast(const(__vector(long[2])))cast(__vector(long[2]))1L)`: both operands are of type `const(__vector(long[2]))` +--- +*/ struct Foo { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10968.d b/gcc/testsuite/gdc.test/fail_compilation/fail10968.d index ef75f91..257d739 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail10968.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail10968.d @@ -43,12 +43,12 @@ void bar() pure @safe /* TEST_OUTPUT: --- -fail_compilation/fail10968.d(66): Error: struct fail10968.SD is not copyable because it is annotated with @disable -fail_compilation/fail10968.d(67): Error: struct fail10968.SD is not copyable because it is annotated with @disable -fail_compilation/fail10968.d(68): Error: struct fail10968.SD is not copyable because it is annotated with @disable -fail_compilation/fail10968.d(71): Error: struct fail10968.SD is not copyable because it is annotated with @disable -fail_compilation/fail10968.d(72): Error: struct fail10968.SD is not copyable because it is annotated with @disable -fail_compilation/fail10968.d(73): Error: struct fail10968.SD is not copyable because it is annotated with @disable +fail_compilation/fail10968.d(66): Error: struct fail10968.SD is not copyable because it is annotated with `@disable` +fail_compilation/fail10968.d(67): Error: struct fail10968.SD is not copyable because it is annotated with `@disable` +fail_compilation/fail10968.d(68): Error: struct fail10968.SD is not copyable because it is annotated with `@disable` +fail_compilation/fail10968.d(71): Error: struct fail10968.SD is not copyable because it is annotated with `@disable` +fail_compilation/fail10968.d(72): Error: struct fail10968.SD is not copyable because it is annotated with `@disable` +fail_compilation/fail10968.d(73): Error: struct fail10968.SD is not copyable because it is annotated with `@disable` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11038.d b/gcc/testsuite/gdc.test/fail_compilation/fail11038.d new file mode 100644 index 0000000..8f39ccc --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail11038.d @@ -0,0 +1,17 @@ +// https://issues.dlang.org/show_bug.cgi?id=11038 +/* +TEST_OUTPUT: +--- +fail_compilation/fail11038.d(16): Error: `writeln` is not defined, perhaps `import std.stdio;` is needed? +--- +*/ + +static +{ + import std.stdio; +} + +void main() +{ + writeln("foo"); // compiles +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11355.d b/gcc/testsuite/gdc.test/fail_compilation/fail11355.d index 474d376..c41a4c4 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail11355.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail11355.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail11355.d(28): Error: struct fail11355.A is not copyable because it is annotated with @disable +fail_compilation/fail11355.d(28): Error: struct fail11355.A is not copyable because it is annotated with `@disable` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11445.d b/gcc/testsuite/gdc.test/fail_compilation/fail11445.d index a3cfc11..ed3f226 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail11445.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail11445.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail11445.d(11): Error: incompatible types for ((a) + (b)): 'double[string]' and 'double[string]' +fail_compilation/fail11445.d(11): Error: incompatible types for ((a) + (b)): both operands are of type 'double[string]' --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail115.d b/gcc/testsuite/gdc.test/fail_compilation/fail115.d index e9d5a67..4990b66 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail115.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail115.d @@ -1,4 +1,11 @@ -// Issue 402 - compiler crash with mixin and forward reference +// https://issues.dlang.org/show_bug.cgi?id=402 +// compiler crash with mixin and forward reference +/* +TEST_OUTPUT: +--- +fail_compilation/fail115.d(17): Error: mixin `Foo!y` cannot resolve forward reference +--- +*/ template Foo(alias b) { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11503a.d b/gcc/testsuite/gdc.test/fail_compilation/fail11503a.d index 28f7bef..b49cde9 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail11503a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail11503a.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail11503a.d(24): Error: cannot implicitly convert expression `makes()` of type `immutable(S)*` to `S*` +--- +*/ struct S { immutable(S)* s; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11503b.d b/gcc/testsuite/gdc.test/fail_compilation/fail11503b.d index 80549de..ebfbbfd 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail11503b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail11503b.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail11503b.d(17): Error: cannot implicitly convert expression `makes()` of type `immutable(int[])` to `int[]` +--- +*/ immutable int[] x = [1, 2, 3]; auto makes() pure diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11503c.d b/gcc/testsuite/gdc.test/fail_compilation/fail11503c.d index dc45eef..ad3963f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail11503c.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail11503c.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail11503c.d(19): Error: cannot implicitly convert expression `d.filename()` of type `const(char)[]` to `string` +--- +*/ struct Data { char[256] buffer; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11503d.d b/gcc/testsuite/gdc.test/fail_compilation/fail11503d.d index d96e2a8..d1605b2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail11503d.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail11503d.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail11503d.d(26): Error: cannot implicitly convert expression `filename(d)` of type `const(char)[]` to `string` +fail_compilation/fail11503d.d(27): Error: cannot implicitly convert expression `filename2(& d)` of type `const(char)[]` to `string` +--- +*/ struct Data2 { char buffer; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail117.d b/gcc/testsuite/gdc.test/fail_compilation/fail117.d index f39a48d..9279d54 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail117.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail117.d @@ -1,8 +1,10 @@ /* TEST_OUTPUT: --- -fail_compilation/fail117.d(35): Error: expression has no value -fail_compilation/fail117.d(36): Error: expression has no value +fail_compilation/fail117.d(37): Error: expression `foo.mixin MGettor!(a) geta; +` is `void` and has no value +fail_compilation/fail117.d(38): Error: expression `foo.mixin MGettor!(b) getb; +` is `void` and has no value --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12.d b/gcc/testsuite/gdc.test/fail_compilation/fail12.d index ad38cd7..aa060e6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail12.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail12.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail12.d(17): Error: function `fail12.main.Foo!(y).abc` at fail_compilation/fail12.d(9) conflicts with function `fail12.main.Foo!(y).abc` at fail_compilation/fail12.d(9) +--- +*/ template Foo(alias b) { int abc() { return b; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail121.d b/gcc/testsuite/gdc.test/fail_compilation/fail121.d index 4bc8179..70e9d0c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail121.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail121.d @@ -1,5 +1,12 @@ // PERMUTE_ARGS: -d -dw // segfault on DMD0.150, never failed if use typeid() instead. +/* +TEST_OUTPUT: +--- +fail_compilation/fail121.d(23): Error: no property `typeinfo` for type `fail121.myobject` +fail_compilation/fail121.d(23): Error: no property `typeinfo` for type `int` +--- +*/ struct myobject { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12485.d b/gcc/testsuite/gdc.test/fail_compilation/fail12485.d deleted file mode 100644 index e1b1577..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/fail12485.d +++ /dev/null @@ -1,12 +0,0 @@ -void dorecursive() -{ - recursive!"ratherLongSymbolNameToHitTheMaximumSymbolLengthEarlierThanTheTemplateRecursionLimit_"; -} - -void recursive(string name)() -{ - struct S {} // define type to kick off mangler - static if (name.length <= (4 << 20)) - recursive!(name ~ name); -} - diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail137.d b/gcc/testsuite/gdc.test/fail_compilation/fail137.d deleted file mode 100644 index 80a2a25..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/fail137.d +++ /dev/null @@ -1,23 +0,0 @@ -// 751 Compiler segfault on template expansion - - template TypeTuple( TList... ) - { - alias TList TypeTuple; - } - - template IndexOf( T, TList... ) - { - static if( TList.length == 0 ) - const size_t IndexOf = 1; - else static if( is( T == typeof( TList[0] ) ) ) - const size_t IndexOf = 0; - else - const size_t IndexOf = 1 + IndexOf!( T, (TList[1 .. $]) ); - } - - void main() - { - TypeTuple!(int, long) T; - printf( "%u\n", IndexOf!(long, T) ); - } - diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14.d b/gcc/testsuite/gdc.test/fail_compilation/fail14.d index 0da6dc4..a44d41cb8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail14.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail14.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail14.d(10): Error: template instance `fail14.A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!(A!int))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))` recursive expansion exceeded allowed nesting limit +--- +*/ class A(T) { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14486.d b/gcc/testsuite/gdc.test/fail_compilation/fail14486.d index ca209aa..84af9cf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail14486.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail14486.d @@ -1,5 +1,44 @@ // REQUIRED_ARGS: -o- +/* +TEST_OUTPUT: +--- +fail_compilation/fail14486.d(56): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(56): Error: `delete c0` is not `@safe` but is used in `@safe` function `test1a` +fail_compilation/fail14486.d(57): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(57): Error: `pure` function `fail14486.test1a` cannot call impure destructor `fail14486.C1a.~this` +fail_compilation/fail14486.d(57): Error: `@safe` function `fail14486.test1a` cannot call `@system` destructor `fail14486.C1a.~this` +fail_compilation/fail14486.d(43): `fail14486.C1a.~this` is declared here +fail_compilation/fail14486.d(57): Error: `@nogc` function `fail14486.test1a` cannot call non-@nogc destructor `fail14486.C1a.~this` +fail_compilation/fail14486.d(62): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(63): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(63): Error: destructor `fail14486.C1b.~this` is not `nothrow` +fail_compilation/fail14486.d(60): Error: `nothrow` function `fail14486.test1b` may throw +fail_compilation/fail14486.d(68): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(68): Error: `delete s0` is not `@safe` but is used in `@safe` function `test2a` +fail_compilation/fail14486.d(69): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(69): Error: `pure` function `fail14486.test2a` cannot call impure destructor `fail14486.S1a.~this` +fail_compilation/fail14486.d(69): Error: `@safe` function `fail14486.test2a` cannot call `@system` destructor `fail14486.S1a.~this` +fail_compilation/fail14486.d(49): `fail14486.S1a.~this` is declared here +fail_compilation/fail14486.d(69): Error: `@nogc` function `fail14486.test2a` cannot call non-@nogc destructor `fail14486.S1a.~this` +fail_compilation/fail14486.d(74): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(75): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(75): Error: destructor `fail14486.S1b.~this` is not `nothrow` +fail_compilation/fail14486.d(72): Error: `nothrow` function `fail14486.test2b` may throw +fail_compilation/fail14486.d(80): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(80): Error: `delete a0` is not `@safe` but is used in `@safe` function `test3a` +fail_compilation/fail14486.d(81): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(81): Error: `pure` function `fail14486.test3a` cannot call impure destructor `fail14486.S1a.~this` +fail_compilation/fail14486.d(81): Error: `@safe` function `fail14486.test3a` cannot call `@system` destructor `fail14486.S1a.~this` +fail_compilation/fail14486.d(49): `fail14486.S1a.~this` is declared here +fail_compilation/fail14486.d(81): Error: `@nogc` function `fail14486.test3a` cannot call non-@nogc destructor `fail14486.S1a.~this` +fail_compilation/fail14486.d(86): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(87): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/fail14486.d(87): Error: destructor `fail14486.S1b.~this` is not `nothrow` +fail_compilation/fail14486.d(84): Error: `nothrow` function `fail14486.test3b` may throw +--- +*/ + class C0a { } class C1a { ~this() {} } class C2a { ~this() {} @nogc pure @safe delete(void* p) {} } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15.d b/gcc/testsuite/gdc.test/fail_compilation/fail15.d index 564ddda..0386b9a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail15.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail15.d @@ -1,4 +1,10 @@ /* +TEST_OUTPUT: +--- +fail_compilation/fail15.d(24): Error: cannot use `[]` operator on expression of type `void` +--- +*/ +/* Segfault on DMD 0.095 http://www.digitalmars.com/d/archives/digitalmars/D/bugs/926.html */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15044.d b/gcc/testsuite/gdc.test/fail_compilation/fail15044.d index 8674b8d..964dcf9 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail15044.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail15044.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail15044.d(30): Error: generated function fail15044.V.opAssign is not callable because it is annotated with @disable +fail_compilation/fail15044.d(30): Error: generated function `fail15044.V.opAssign` cannot be used because it is annotated with `@disable` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15361.d b/gcc/testsuite/gdc.test/fail_compilation/fail15361.d new file mode 100644 index 0000000..8e5f980 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail15361.d @@ -0,0 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail15361.d(8): Error: unexpected `(` after `errorize`, inside `is` expression. Try enclosing the contents of `is` with a `typeof` expression +--- +*/ + +enum isErrorizable(T) = is(errorize(T.init)); diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15616b.d b/gcc/testsuite/gdc.test/fail_compilation/fail15616b.d index 53defae..4776f40 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail15616b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail15616b.d @@ -1,5 +1,6 @@ /* REQUIRED_ARGS: -v +TEST_OUTPUT: --- fail_compilation/fail15616b.d(43): Error: none of the overloads of 'foo' are callable using argument types (double), candidates are: fail_compilation/fail15616b.d(16): fail15616b.foo(int a) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15896.d b/gcc/testsuite/gdc.test/fail_compilation/fail15896.d new file mode 100644 index 0000000..e52503d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail15896.d @@ -0,0 +1,18 @@ +// REQUIRED_ARGS: -de +// EXTRA_FILES: imports/imp15896.d +/* +TEST_OUTPUT: +--- +fail_compilation/fail15896.d(11): Error: module `imports.imp15896` member `thebar` is not visible from module `fail15896` +fail_compilation/fail15896.d(11): Error: module `imports.imp15896` member `packagebar` is not visible from module `fail15896` +--- +*/ + +import imports.imp15896 : thebar, packagebar; + +int func() +{ + thebar +=1; + packagebar += 1; + return 0; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail16.d b/gcc/testsuite/gdc.test/fail_compilation/fail16.d index c9af9d3..6c7a90a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail16.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail16.d @@ -1,4 +1,11 @@ // ICE(template.c) in DMD0.080 +/* +TEST_OUTPUT: +--- +fail_compilation/fail16.d(19): Error: function declaration without return type. (Note that constructors are always named `this`) +fail_compilation/fail16.d(19): Error: no identifier for declarator `bar!(typeof(X))(X)` +--- +*/ int i; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail16206a.d b/gcc/testsuite/gdc.test/fail_compilation/fail16206a.d new file mode 100644 index 0000000..3c1cc56 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail16206a.d @@ -0,0 +1,12 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail16206a.d(12): Error: `bool` expected as third argument of `__traits(getOverloads)`, not `"Not a bool"` of type `string` +--- +*/ + +struct S { + static int foo()() { return 0; } +} +alias AliasSeq(T...) = T; +alias allFoos = AliasSeq!(__traits(getOverloads, S, "foo", "Not a bool"));
\ No newline at end of file diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail16206b.d b/gcc/testsuite/gdc.test/fail_compilation/fail16206b.d new file mode 100644 index 0000000..9b3a69c --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail16206b.d @@ -0,0 +1,12 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail16206b.d(12): Error: expected 2 arguments for `hasMember` but had 3 +--- +*/ + +struct S { + static int foo()() { return 0; } +} +alias AliasSeq(T...) = T; +alias allFoos = AliasSeq!(__traits(hasMember, S, "foo", true));
\ No newline at end of file diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17.d b/gcc/testsuite/gdc.test/fail_compilation/fail17.d index fa3b488..2c73d30 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail17.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail17.d @@ -1,3 +1,11 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail17.d(11): Error: undefined identifier `B` +fail_compilation/fail17.d(11): Error: mixin `fail17.A!int.A.B!(T, A!T)` is not defined +fail_compilation/fail17.d(14): Error: template instance `fail17.A!int` error instantiating +--- +*/ struct A(T) { mixin B!(T, A!(T)); diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17502.d b/gcc/testsuite/gdc.test/fail_compilation/fail17502.d index 8202b1e..b1366d1 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail17502.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail17502.d @@ -1,10 +1,10 @@ /* TEST_OUTPUT: --- -fail_compilation/fail17502.d(12): Error: function fail17502.Foo.foo void functions have no result -fail_compilation/fail17502.d(13): Error: cannot have parameter of type const(void) -fail_compilation/fail17502.d(16): Error: function fail17502.Foo.bar void functions have no result -fail_compilation/fail17502.d(17): Error: cannot have parameter of type const(void) +fail_compilation/fail17502.d(13): Error: function `fail17502.Foo.foo` `void` functions have no result +fail_compilation/fail17502.d(13): Error: undefined identifier `res` +fail_compilation/fail17502.d(17): Error: function `fail17502.Foo.bar` `void` functions have no result +fail_compilation/fail17502.d(17): Error: undefined identifier `res` --- */ class Foo diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17630.d b/gcc/testsuite/gdc.test/fail_compilation/fail17630.d new file mode 100644 index 0000000..9b6ed82 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail17630.d @@ -0,0 +1,15 @@ +// REQUIRED_ARGS: -de +// EXTRA_FILES: imports/a17630.d +// EXTRA_SOURCES: imports/b17630.d +/* +TEST_OUTPUT: +--- +fail_compilation/fail17630.d(13): Error: module `a17630` import `Erase` not found, did you mean variable `b17630.Erase`? +--- +*/ + +void main() +{ + import imports.a17630 : Erase; + assert(Erase == 2); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail18143.d b/gcc/testsuite/gdc.test/fail_compilation/fail18143.d new file mode 100644 index 0000000..28df93a --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail18143.d @@ -0,0 +1,43 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail18143.d(20): Error: variable `fail18143.S.a` cannot modify parameter `this` in contract +fail_compilation/fail18143.d(21): Error: variable `fail18143.S.a` cannot modify parameter `this` in contract +fail_compilation/fail18143.d(25): Error: variable `fail18143.S.a` cannot modify parameter `this` in contract +fail_compilation/fail18143.d(26): Error: variable `fail18143.S.a` cannot modify parameter `this` in contract +fail_compilation/fail18143.d(35): Error: variable `fail18143.C.a` cannot modify parameter `this` in contract +fail_compilation/fail18143.d(36): Error: variable `fail18143.C.a` cannot modify parameter `this` in contract +fail_compilation/fail18143.d(40): Error: variable `fail18143.C.a` cannot modify parameter `this` in contract +fail_compilation/fail18143.d(41): Error: variable `fail18143.C.a` cannot modify parameter `this` in contract +--- +*/ + +struct S +{ + int a; + + this(int n) + in { a = n; } // error, modifying this.a in contract + out { a = n; } // error, modifying this.a in contract + do { } + + void foo(int n) + in { a = n; } // error, modifying this.a in contract + out { a = n; } // error, modifying this.a in contract + do { } +} + +class C +{ + int a; + + this(int n) + in { a = n; } // error, modifying this.a in contract + out { a = n; } // error, modifying this.a in contract + do { } + + void foo(int n) + in { a = n; } // error, modifying this.a in contract + out { a = n; } // error, modifying this.a in contract + do { } +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail18219.d b/gcc/testsuite/gdc.test/fail_compilation/fail18219.d new file mode 100644 index 0000000..f3ec680 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail18219.d @@ -0,0 +1,20 @@ +// EXTRA_SOURCES: imports/b18219.d +// EXTRA_FILES: imports/a18219.d +/* +TEST_OUTPUT: +--- +fail_compilation/fail18219.d(16): Error: no property `Foobar` for type `AST`, did you mean `b18219.Foobar`? +fail_compilation/fail18219.d(17): Error: no property `Bar` for type `a18219.AST` +fail_compilation/fail18219.d(18): Error: no property `fun` for type `AST`, did you mean `b18219.fun`? +fail_compilation/fail18219.d(19): Error: no property `Foobar` for type `AST`, did you mean `b18219.Foobar`? +--- +*/ +import imports.a18219; + +void main() +{ + AST.Foobar t; + AST.Bar l; + AST.fun(); + AST.Foobar.smeth(); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail18719.d b/gcc/testsuite/gdc.test/fail_compilation/fail18719.d new file mode 100644 index 0000000..7d993d1 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail18719.d @@ -0,0 +1,41 @@ +// https://issues.dlang.org/show_bug.cgi?id=18719 + +// REQUIRED_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/fail18719.d(30): Error: immutable field `x` initialized multiple times + Previous initialization is here. +--- +*/ + +struct S +{ + int x = -1; + this(int y) immutable + { + x = y; + import std.stdio; + writeln("Ctor called with ", y); + } + void opAssign(int) immutable; +} + +class C +{ + S x; + this() immutable + { + this(42); /* Initializes x. */ + x = 13; /* Breaking immutable, or ok? */ + } + this(int x) immutable + { + this.x = x; + } +} + +void main() +{ + new immutable C; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19107.d b/gcc/testsuite/gdc.test/fail_compilation/fail19107.d new file mode 100644 index 0000000..c748650 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19107.d @@ -0,0 +1,21 @@ +// REQUIRED_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/test19107.d(20): Error: template `test19107.all` cannot deduce function from argument types `!((c) => c)(string[])`, candidates are: +fail_compilation/test19107.d(14): `test19107.all(alias pred, T)(T t) if (is(typeof(I!pred(t))))` +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=19107 + +import imports.test19107b; + +void all(alias pred, T)(T t) + if (is(typeof(I!pred(t)))) +{ } + +void main(string[] args) +{ + args.all!(c => c); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail196.d b/gcc/testsuite/gdc.test/fail_compilation/fail196.d index 2a2812b..78fc361 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail196.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail196.d @@ -1,3 +1,25 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail196.d(26): Error: delimited string must end in )" +fail_compilation/fail196.d(26): Error: Implicit string concatenation is error-prone and disallowed in D +fail_compilation/fail196.d(26): Use the explicit syntax instead (concatenating literals is `@nogc`): "foo(xxx)" ~ ";\x0a assert(s == " +fail_compilation/fail196.d(27): Error: semicolon expected, not `foo` +fail_compilation/fail196.d(27): Error: found `");\x0a\x0a s = q"` when expecting `;` following statement +fail_compilation/fail196.d(29): Error: found `";\x0a assert(s == "` when expecting `;` following statement +fail_compilation/fail196.d(30): Error: found `");\x0a\x0a s = q"` when expecting `;` following statement +fail_compilation/fail196.d(32): Error: found `{` when expecting `;` following statement +fail_compilation/fail196.d(32): Error: found `}` when expecting `;` following statement +fail_compilation/fail196.d(33): Error: found `foo` when expecting `;` following statement +fail_compilation/fail196.d(33): Error: found `}` when expecting `;` following statement +fail_compilation/fail196.d(35): Error: found `<` when expecting `;` following statement +fail_compilation/fail196.d(36): Error: found `foo` when expecting `;` following statement +fail_compilation/fail196.d(36): Error: found `<` instead of statement +fail_compilation/fail196.d(42): Error: unterminated string constant starting at fail_compilation/fail196.d(42) +fail_compilation/fail196.d(44): Error: found `End of File` when expecting `}` following compound statement +fail_compilation/fail196.d(44): Error: found `End of File` when expecting `}` following compound statement +--- +*/ void main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19890a.d b/gcc/testsuite/gdc.test/fail_compilation/fail19890a.d index 57c4caf..2120dc5 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail19890a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19890a.d @@ -1,5 +1,6 @@ // PERMUTE_ARGS: /* +TEST_OUTPUT: --- fail_compilation/fail19890a.d(8): Error: `void[/^[0-9]+(LU)?$/]` size 1 * /^[0-9]+$/ exceeds 0x7fffffff size limit for static array --- diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19890b.d b/gcc/testsuite/gdc.test/fail_compilation/fail19890b.d index a9b1874..c3ee677 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail19890b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19890b.d @@ -1,5 +1,6 @@ // PERMUTE_ARGS: /* +TEST_OUTPUT: --- fail_compilation/fail19890b.d(8): Error: `void[/^[0-9]+(LU)?$/]` size 1 * /^[0-9]+$/ exceeds 0x7fffffff size limit for static array --- diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail199.d b/gcc/testsuite/gdc.test/fail_compilation/fail199.d index e293aa1..9cb14b8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail199.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail199.d @@ -1,4 +1,11 @@ // REQUIRED_ARGS: -de +/* +TEST_OUTPUT: +--- +fail_compilation/fail199.d(20): Deprecation: class `fail199.DepClass` is deprecated +fail_compilation/fail199.d(20): Deprecation: class `fail199.DepClass` is deprecated +--- +*/ //import std.stdio; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail200.d b/gcc/testsuite/gdc.test/fail_compilation/fail200.d index c0ba46c..9d804a9 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail200.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail200.d @@ -1,4 +1,11 @@ // REQUIRED_ARGS: -de +/* +TEST_OUTPUT: +--- +fail_compilation/fail200.d(17): Deprecation: interface `fail200.DepClass` is deprecated +fail_compilation/fail200.d(17): Deprecation: interface `fail200.DepClass` is deprecated +--- +*/ //import std.stdio; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail201.d b/gcc/testsuite/gdc.test/fail_compilation/fail201.d index d9655b3b..6c4d923 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail201.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail201.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail201.d(10): Error: shift by 33 is outside the range `0..31` +fail_compilation/fail201.d(10): Error: shift by 33 is outside the range `0..31` +--- +*/ void main() { int c; c = c >>> 33; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail202.d b/gcc/testsuite/gdc.test/fail_compilation/fail202.d index 78cf21a..57009ed 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail202.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail202.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail202.d(10): Error: shift by 33 is outside the range `0..31` +fail_compilation/fail202.d(10): Error: shift by 33 is outside the range `0..31` +--- +*/ void main() { int c; c = c >> 33; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail203.d b/gcc/testsuite/gdc.test/fail_compilation/fail203.d index 3d96e0c..51accf5 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail203.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail203.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail203.d(10): Error: shift by 33 is outside the range `0..31` +fail_compilation/fail203.d(10): Error: shift by 33 is outside the range `0..31` +--- +*/ void main() { int c; c = c << 33; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail204.d b/gcc/testsuite/gdc.test/fail_compilation/fail204.d index 41b7c29..e6f2faa 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail204.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail204.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail204.d(9): Error: shift assign by 65 is outside the range `0..63` +--- +*/ void main() { long c; c >>= 65; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail205.d b/gcc/testsuite/gdc.test/fail_compilation/fail205.d index 04ef95e..89ddc93 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail205.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail205.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail205.d(9): Error: shift assign by 65 is outside the range `0..63` +--- +*/ void main() { long c; c <<= 65; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail206.d b/gcc/testsuite/gdc.test/fail_compilation/fail206.d index 6c0bf46..e3b2dce 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail206.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail206.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail206.d(9): Error: shift assign by 65 is outside the range `0..63` +--- +*/ void main() { long c; c >>>= 65; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail217.d b/gcc/testsuite/gdc.test/fail_compilation/fail217.d index 67c28cd..63ed0a0 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail217.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail217.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail217.d(22): Error: mutable method `fail217.Message.this` is not callable using a `immutable` object +fail_compilation/fail217.d(13): Consider adding `const` or `inout` here +--- +*/ class Message { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail220.d b/gcc/testsuite/gdc.test/fail_compilation/fail220.d index 5e2f130..294dc21 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail220.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail220.d @@ -1,3 +1,13 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail220.d(12): Error: identifier expected for template value parameter +fail_compilation/fail220.d(12): Error: found `==` when expecting `)` +fail_compilation/fail220.d(12): Error: found `class` when expecting `)` +fail_compilation/fail220.d(12): Error: declaration expected, not `)` +fail_compilation/fail220.d(16): Error: unrecognized declaration +--- +*/ template types (T) { static if (is (T V : V[K], K == class)) { static assert (false, "assoc"); diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22006.d b/gcc/testsuite/gdc.test/fail_compilation/fail22006.d new file mode 100644 index 0000000..89bbc28 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail22006.d @@ -0,0 +1,22 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail22006.d(15): Error: cannot implicitly convert expression `4$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `bool` +fail_compilation/fail22006.d(16): Error: index type `bool` cannot cover index range 0..4 +fail_compilation/fail22006.d(19): Error: cannot implicitly convert expression `4$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `bool` +fail_compilation/fail22006.d(20): Error: index type `bool` cannot cover index range 0..4 +--- +*/ +void test22006() +{ + alias AliasSeq(TList...) = TList; + { + alias aseq = AliasSeq!(0, 1, 2, 3); + static foreach (bool i; 0 .. aseq.length) {} + static foreach (bool i, x; aseq) {} + } + { + static foreach (bool i; 0 .. [0, 1, 2, 3].length) {} + static foreach (bool i, x; [0, 1, 2, 3]) {} + } +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22133.d b/gcc/testsuite/gdc.test/fail_compilation/fail22133.d new file mode 100644 index 0000000..338d96d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail22133.d @@ -0,0 +1,24 @@ +// https://issues.dlang.org/show_bug.cgi?id=22133 +/* +TEST_OUTPUT +--- +fail_compilation/fail22133.d(16): Error: `s.popFront()()` has no effect +fail_compilation/fail22133.d(17): Error: template `s.popFront()()` has no type +--- +*/ +struct Slice +{ + void popFront()() {} +} + +auto fail22133(const Slice s) +{ + s.popFront; + return s.popFront; +} + +auto ok22133(Slice s) +{ + s.popFront; + return s.popFront; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22144.d b/gcc/testsuite/gdc.test/fail_compilation/fail22144.d new file mode 100644 index 0000000..e0fd5b1 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail22144.d @@ -0,0 +1,14 @@ +// https://issues.dlang.org/show_bug.cgi?id=22144 +/* TEST_OUTPUT +--- +fail_compilation/fail22144.d(12): Error: cannot cast expression `zarray1` of type `int[0]` to `int[0][]` since sizes don't line up +--- +*/ +void main() +{ + int[0] zarray1; + int[0][0] zarray2; + + auto zslice1 = cast(int[0][])zarray1; // ICE -> Error + auto zslice2 = cast(int[0][])zarray2; // ICE -> OK +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail225.d b/gcc/testsuite/gdc.test/fail_compilation/fail225.d index 6cf59f3..dee9a54 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail225.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail225.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail225.d(15): Error: cannot implicitly convert expression `1` of type `int` to `immutable(char*)` +fail_compilation/fail225.d(15): Error: cannot implicitly convert expression `& ch` of type `char*` to `immutable(char*)` +--- +*/ struct Struct { char* chptr; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail232.d b/gcc/testsuite/gdc.test/fail_compilation/fail232.d index ee2f431..d2e68d4 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail232.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail232.d @@ -1,3 +1,14 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail232.d(15): Error: shift by 33 is outside the range `0..31` +fail_compilation/fail232.d(15): Error: shift by 33 is outside the range `0..31` +fail_compilation/fail232.d(16): Error: shift by 33 is outside the range `0..31` +fail_compilation/fail232.d(16): Error: shift by 33 is outside the range `0..31` +fail_compilation/fail232.d(17): Error: shift by 33 is outside the range `0..31` +fail_compilation/fail232.d(17): Error: shift by 33 is outside the range `0..31` +--- +*/ void bug1601() { int i; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d b/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d index cb565ba..a312dc0 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d @@ -3,10 +3,10 @@ TEST_OUTPUT: --- fail_compilation/fail238_m32.d(21): Error: cannot implicitly convert expression `"a"` of type `string` to `uint` -fail_compilation/fail238_m32.d(24): Error: cannot interpret X!() at compile time -fail_compilation/fail238_m32.d(29): Error: template instance fail238_m32.A!"a" error instantiating -fail_compilation/fail238_m32.d(35): instantiated from here: M!(q) -fail_compilation/fail238_m32.d(35): while evaluating pragma(msg, M!(q)) +fail_compilation/fail238_m32.d(24): Error: cannot implicitly convert expression `X!()` of type `void` to `const(string)` +fail_compilation/fail238_m32.d(29): Error: template instance `fail238_m32.A!"a"` error instantiating +fail_compilation/fail238_m32.d(35): instantiated from here: `M!(q)` +fail_compilation/fail238_m32.d(35): while evaluating `pragma(msg, M!(q))` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d b/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d index 08837b2..dc7a50e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d @@ -3,10 +3,10 @@ TEST_OUTPUT: --- fail_compilation/fail238_m64.d(21): Error: cannot implicitly convert expression `"a"` of type `string` to `ulong` -fail_compilation/fail238_m64.d(24): Error: cannot interpret X!() at compile time -fail_compilation/fail238_m64.d(29): Error: template instance fail238_m64.A!"a" error instantiating -fail_compilation/fail238_m64.d(35): instantiated from here: M!(q) -fail_compilation/fail238_m64.d(35): while evaluating pragma(msg, M!(q)) +fail_compilation/fail238_m64.d(24): Error: cannot implicitly convert expression `X!()` of type `void` to `const(string)` +fail_compilation/fail238_m64.d(29): Error: template instance `fail238_m64.A!"a"` error instantiating +fail_compilation/fail238_m64.d(35): instantiated from here: `M!(q)` +fail_compilation/fail238_m64.d(35): while evaluating `pragma(msg, M!(q))` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail239.d b/gcc/testsuite/gdc.test/fail_compilation/fail239.d index 81fbca2..14b6443 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail239.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail239.d @@ -1,2 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail239.d(8): Error: type `F` is not an expression +--- +*/ class F { int x; } alias typeof(F).x b; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail252.d b/gcc/testsuite/gdc.test/fail_compilation/fail252.d index 3d2db65..e9ea2bf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail252.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail252.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail252.d(13): Error: cannot implicitly override base class method `fail252.Timer.Task.run` with `fail252.Timer.__anonclass1.run`; add `override` attribute +--- +*/ class Timer { abstract class Task { public abstract void run(); diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail257.d b/gcc/testsuite/gdc.test/fail_compilation/fail257.d index 249a524..0e2d669 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail257.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail257.d @@ -1 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail257.d(8): Error: incompatible types for `("foo"d) == ("bar"c)`: `dstring` and `string` +fail_compilation/fail257.d(8): while evaluating `pragma(msg, "foo"d == "bar"c ? "A" : "B")` +--- +*/ pragma(msg, "foo"d == "bar"c ? "A" : "B"); diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail258.d b/gcc/testsuite/gdc.test/fail_compilation/fail258.d index 97381a6..459d271 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail258.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail258.d @@ -1,3 +1,13 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail258.d(11): Error: delimiter cannot be whitespace +fail_compilation/fail258.d(11): Error: delimited string must end in +" +fail_compilation/fail258.d(11): Error: declaration expected, not `"X"` +fail_compilation/fail258.d(14): Error: unterminated string constant starting at fail_compilation/fail258.d(14) +--- +*/ q" X diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail262.d b/gcc/testsuite/gdc.test/fail_compilation/fail262.d index 93e6af0..6d15e1a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail262.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail262.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail262.d(23): Error: function fail262.B.f does not override any function +fail_compilation/fail262.d(23): Error: function `const void fail262.B.f()` does not override any function, did you mean to override `shared const void fail262.A.f()`? --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail263.d b/gcc/testsuite/gdc.test/fail_compilation/fail263.d index f7dfe21..8cf9b20 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail263.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail263.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail263.d(18): Error: function fail263.f (byte* p) is not callable using argument types (const(byte)*) +fail_compilation/fail263.d(19): Error: function `fail263.f(byte* p)` is not callable using argument types `(const(byte)*)` +fail_compilation/fail263.d(19): cannot pass argument `cast(const(byte)*)A` of type `const(byte)*` to parameter `byte* p` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail2740.d b/gcc/testsuite/gdc.test/fail_compilation/fail2740.d index af7334f..340be52 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail2740.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail2740.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail2740.d(17): Error: class `fail2740.Foo` ambiguous virtual function `foo` +--- +*/ interface IFoo { int foo(); diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail276.d b/gcc/testsuite/gdc.test/fail_compilation/fail276.d index 052558c..4f9b7c3 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail276.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail276.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail276.d(19): Error: `this` has no effect +fail_compilation/fail276.d(15): Error: `this` is only defined in non-static member functions, not `__anonclass2` +--- +*/ class C { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail279.d b/gcc/testsuite/gdc.test/fail_compilation/fail279.d index 22d795e..8fa7aa4 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail279.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail279.d @@ -1,4 +1,12 @@ -// Issue 2920 - recursive templates blow compiler stack +/* +TEST_OUTPUT: +--- +fail_compilation/fail279.d(14): Error: mixin `fail279.Template!0.Template!1.Template!2.Template!3.Template!4.Template!5.Template!6.Template!7.Template!8.Template!9.Template!10.Template!11.Template!12.Template!13.Template!14.Template!15.Template!16.Template!17.Template!18.Template!19.Template!20.Template!21.Template!22.Template!23.Template!24.Template!25.Template!26.Template!27.Template!28.Template!29.Template!30.Template!31.Template!32.Template!33.Template!34.Template!35.Template!36.Template!37.Template!38.Template!39.Template!40.Template!41.Template!42.Template!43.Template!44.Template!45.Template!46.Template!47.Template!48.Template!49.Template!50.Template!51.Template!52.Template!53.Template!54.Template!55.Template!56.Template!57.Template!58.Template!59.Template!60.Template!61.Template!62.Template!63.Template!64.Template!65.Template!66.Template!67.Template!68.Template!69.Template!70.Template!71.Template!72.Template!73.Template!74.Template!75.Template!76.Template!77.Template!78.Template!79.Template!80.Template!81.Template!82.Template!83.Template!84.Template!85.Template!86.Template!87.Template!88.Template!89.Template!90.Template!91.Template!92.Template!93.Template!94.Template!95.Template!96.Template!97.Template!98.Template!99.Template!100.Template!101.Template!102.Template!103.Template!104.Template!105.Template!106.Template!107.Template!108.Template!109.Template!110.Template!111.Template!112.Template!113.Template!114.Template!115.Template!116.Template!117.Template!118.Template!119.Template!120.Template!121.Template!122.Template!123.Template!124.Template!125.Template!126.Template!127.Template!128.Template!129.Template!130.Template!131.Template!132.Template!133.Template!134.Template!135.Template!136.Template!137.Template!138.Template!139.Template!140.Template!141.Template!142.Template!143.Template!144.Template!145.Template!146.Template!147.Template!148.Template!149.Template!150.Template!151.Template!152.Template!153.Template!154.Template!155.Template!156.Template!157.Template!158.Template!159.Template!160.Template!161.Template!162.Template!163.Template!164.Template!165.Template!166.Template!167.Template!168.Template!169.Template!170.Template!171.Template!172.Template!173.Template!174.Template!175.Template!176.Template!177.Template!178.Template!179.Template!180.Template!181.Template!182.Template!183.Template!184.Template!185.Template!186.Template!187.Template!188.Template!189.Template!190.Template!191.Template!192.Template!193.Template!194.Template!195.Template!196.Template!197.Template!198.Template!199.Template!200.Template!201.Template!202.Template!203.Template!204.Template!205.Template!206.Template!207.Template!208.Template!209.Template!210.Template!211.Template!212.Template!213.Template!214.Template!215.Template!216.Template!217.Template!218.Template!219.Template!220.Template!221.Template!222.Template!223.Template!224.Template!225.Template!226.Template!227.Template!228.Template!229.Template!230.Template!231.Template!232.Template!233.Template!234.Template!235.Template!236.Template!237.Template!238.Template!239.Template!240.Template!241.Template!242.Template!243.Template!244.Template!245.Template!246.Template!247.Template!248.Template!249.Template!250.Template!251.Template!252.Template!253.Template!254.Template!255.Template!256.Template!257.Template!258.Template!259.Template!260.Template!261.Template!262.Template!263.Template!264.Template!265.Template!266.Template!267.Template!268.Template!269.Template!270.Template!271.Template!272.Template!273.Template!274.Template!275.Template!276.Template!277.Template!278.Template!279.Template!280.Template!281.Template!282.Template!283.Template!284.Template!285.Template!286.Template!287.Template!288.Template!289.Template!290.Template!291.Template!292.Template!293.Template!294.Template!295.Template!296.Template!297.Template!298.Template!299.Template!300.Template!301.Template!302.Template!303.Template!304.Template!305.Template!306.Template!307.Template!308.Template!309.Template!310.Template!311.Template!312.Template!313.Template!314.Template!315.Template!316.Template!317.Template!318.Template!319.Template!320.Template!321.Template!322.Template!323.Template!324.Template!325.Template!326.Template!327.Template!328.Template!329.Template!330.Template!331.Template!332.Template!333.Template!334.Template!335.Template!336.Template!337.Template!338.Template!339.Template!340.Template!341.Template!342.Template!343.Template!344.Template!345.Template!346.Template!347.Template!348.Template!349.Template!350.Template!351.Template!352.Template!353.Template!354.Template!355.Template!356.Template!357.Template!358.Template!359.Template!360.Template!361.Template!362.Template!363.Template!364.Template!365.Template!366.Template!367.Template!368.Template!369.Template!370.Template!371.Template!372.Template!373.Template!374.Template!375.Template!376.Template!377.Template!378.Template!379.Template!380.Template!381.Template!382.Template!383.Template!384.Template!385.Template!386.Template!387.Template!388.Template!389.Template!390.Template!391.Template!392.Template!393.Template!394.Template!395.Template!396.Template!397.Template!398.Template!399.Template!400.Template!401.Template!402.Template!403.Template!404.Template!405.Template!406.Template!407.Template!408.Template!409.Template!410.Template!411.Template!412.Template!413.Template!414.Template!415.Template!416.Template!417.Template!418.Template!419.Template!420.Template!421.Template!422.Template!423.Template!424.Template!425.Template!426.Template!427.Template!428.Template!429.Template!430.Template!431.Template!432.Template!433.Template!434.Template!435.Template!436.Template!437.Template!438.Template!439.Template!440.Template!441.Template!442.Template!443.Template!444.Template!445.Template!446.Template!447.Template!448.Template!449.Template!450.Template!451.Template!452.Template!453.Template!454.Template!455.Template!456.Template!457.Template!458.Template!459.Template!460.Template!461.Template!462.Template!463.Template!464.Template!465.Template!466.Template!467.Template!468.Template!469.Template!470.Template!471.Template!472.Template!473.Template!474.Template!475.Template!476.Template!477.Template!478.Template!479.Template!480.Template!481.Template!482.Template!483.Template!484.Template!485.Template!486.Template!487.Template!488.Template!489.Template!490.Template!491.Template!492.Template!493.Template!494.Template!495.Template!496.Template!497.Template!498.Template!499.Template!500` recursive expansion +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=2920 +// recursive templates blow compiler stack // template_16 template Template(int i) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail280.d b/gcc/testsuite/gdc.test/fail_compilation/fail280.d index 796d171..95e6c23 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail280.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail280.d @@ -1,5 +1,12 @@ -// Issue 2920 - recursive templates blow compiler stack +// https://issues.dlang.org/show_bug.cgi?id=2920 +// recursive templates blow compiler stack // template_17_A. +/* +TEST_OUTPUT: +--- +fail_compilation/fail280.d(13): Error: template instance `fail280.t!500` recursive expansion exceeded allowed nesting limit +--- +*/ template t(int i) { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail281.d b/gcc/testsuite/gdc.test/fail_compilation/fail281.d index daa9385..3b9bcd7 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail281.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail281.d @@ -1,5 +1,12 @@ -// Issue 2920 - recursive templates blow compiler stack +// https://issues.dlang.org/show_bug.cgi?id=2920 +// recursive templates blow compiler stack // template_29_B. +/* +TEST_OUTPUT: +--- +fail_compilation/fail281.d(15): Error: template instance `fail281.foo!4294966795u` recursive expansion exceeded allowed nesting limit +--- +*/ template foo(uint i) { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3.d b/gcc/testsuite/gdc.test/fail_compilation/fail3.d index 332e561..0b7516c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail3.d(40): Error: incompatible types for ((a) + (b)): 'vec2' and 'vec2' +fail_compilation/fail3.d(41): Error: incompatible types for ((a) + (b)): both operands are of type 'vec2' --- */ @@ -14,6 +14,7 @@ template vector(T) T x, y; } + // not struct member vec2 opAdd(vec2 a, vec2 b) { vec2 r; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail308.d b/gcc/testsuite/gdc.test/fail_compilation/fail308.d index d283da0..d885b3e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail308.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail308.d @@ -1,4 +1,10 @@ // REQUIRED_ARGS: -unittest +/* +TEST_OUTPUT: +--- +fail_compilation/fail308.d(18): Error: template instance `object.RTInfo!(TestType)` recursive expansion +--- +*/ void main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail313.d b/gcc/testsuite/gdc.test/fail_compilation/fail313.d index 8f11001..a2c2890 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail313.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail313.d @@ -2,11 +2,9 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/fail313.d(18): Deprecation: module imports.b313 is not accessible here, perhaps add 'static import imports.b313;' -fail_compilation/fail313.d(25): Deprecation: imports.a313.core is not visible from module test313 -fail_compilation/fail313.d(25): Deprecation: package core.stdc is not accessible here -fail_compilation/fail313.d(25): Deprecation: module core.stdc.stdio is not accessible here, perhaps add 'static import core.stdc.stdio;' -fail_compilation/fail313.d(30): Deprecation: package imports.pkg313 is not accessible here, perhaps add 'static import imports.pkg313;' +fail_compilation/fail313.d(15): Error: undefined identifier `b313` in package `imports`, perhaps add `static import imports.b313;` +fail_compilation/fail313.d(22): Error: undefined identifier `core` +fail_compilation/fail313.d(27): Error: undefined identifier `pkg313` in package `imports`, perhaps add `static import imports.pkg313;` --- */ module test313; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3150.d b/gcc/testsuite/gdc.test/fail_compilation/fail3150.d index 3382bad..5ca758c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3150.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3150.d @@ -1,4 +1,10 @@ // REQUIRED_ARGS: -de +/* +TEST_OUTPUT: +--- +fail_compilation/fail3150.d(10): Error: cannot cast expression `[1, 2]` of type `int[]` to `ulong` +--- +*/ void main() { ulong u = cast(ulong)[1,2]; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail316.d b/gcc/testsuite/gdc.test/fail_compilation/fail316.d index 21788d6..ab4077c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail316.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail316.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail316.d(17): Error: mixin `fail316.foo.BadImpl!(uint, Mix1)` cannot resolve forward reference +--- +*/ template BadImpl(T, alias thename) { void a_bad_idea(T t) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail322.d b/gcc/testsuite/gdc.test/fail_compilation/fail322.d index 0ffa15a..491111f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail322.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail322.d @@ -1,13 +1,18 @@ /* TEST_OUTPUT: --- -fail_compilation/fail322.d(10): Error: function fail322.digestToString2 (ref char[16] digest) is not callable using argument types (string) +fail_compilation/fail322.d(13): Error: function `fail322.digestToString2(ref char[16] digest)` is not callable using argument types `(string)` +fail_compilation/fail322.d(13): cannot pass rvalue argument `"1234567890123456"` of type `string` to parameter `ref char[16] digest` +fail_compilation/fail322.d(15): Error: function `fail322.digestToString2(ref char[16] digest)` is not callable using argument types `(const(char[16]))` +fail_compilation/fail322.d(15): cannot pass argument `s` of type `const(char[16])` to parameter `ref char[16] digest` --- */ void main() { digestToString2("1234567890123456"); + const char[16] s; + digestToString2(s); } void digestToString2(ref char[16] digest) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail324.d b/gcc/testsuite/gdc.test/fail_compilation/fail324.d index 9963c8b..931cb8d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail324.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail324.d @@ -1,5 +1,5 @@ /* -test_output: +TEST_OUTPUT: --- fail_compilation/fail324.d(16): Error: template instance doStuff!((i){ return i; }) cannot use local '__lambda1' as parameter to non-global template doStuff(alias fun)() --- diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3290.d b/gcc/testsuite/gdc.test/fail_compilation/fail3290.d index f398fc9..2b6bbac 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3290.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3290.d @@ -1,4 +1,10 @@ -// 3290 +// https://issues.dlang.org/show_bug.cgi?id=3290 +/* +TEST_OUTPUT: +--- +fail_compilation/fail3290.d(12): Error: argument type mismatch, `const(int)` to `ref int` +--- +*/ void main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail332.d b/gcc/testsuite/gdc.test/fail_compilation/fail332.d index 03f3706..91f8046 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail332.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail332.d @@ -1,15 +1,56 @@ /* TEST_OUTPUT: --- -fail_compilation/fail332.d(14): Error: function fail332.foo (int _param_0, ...) is not callable using argument types () +fail_compilation/fail332.d(22): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `()` +fail_compilation/fail332.d(22): missing argument for parameter #1: `int _param_0` +fail_compilation/fail332.d(23): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `(typeof(null))` +fail_compilation/fail332.d(23): cannot pass argument `null` of type `typeof(null)` to parameter `int _param_0` +fail_compilation/fail332.d(25): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(string)` +fail_compilation/fail332.d(25): cannot pass argument `""` of type `string` to parameter `int[] _param_0...` +fail_compilation/fail332.d(26): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(int, typeof(null))` +fail_compilation/fail332.d(26): cannot pass argument `null` of type `typeof(null)` to parameter `int[] _param_0...` --- */ import core.vararg; void foo(int, ...) {} +void baz(int[]...) {} -void bar() +void test() { foo(); + foo(null); + + baz(""); + baz(3, null); +} + +/* +TEST_OUTPUT: +--- +fail_compilation/fail332.d(50): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `()` +fail_compilation/fail332.d(50): missing argument for parameter #1: `Object` +fail_compilation/fail332.d(51): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(int)` +fail_compilation/fail332.d(51): cannot pass argument `4` of type `int` to parameter `Object` +fail_compilation/fail332.d(52): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null))` +fail_compilation/fail332.d(52): expected 2 variadic argument(s), not 0 +fail_compilation/fail332.d(53): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int)` +fail_compilation/fail332.d(53): expected 2 variadic argument(s), not 1 +fail_compilation/fail332.d(54): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, string)` +fail_compilation/fail332.d(54): cannot pass argument `""` of type `string` to parameter `int[2]...` +fail_compilation/fail332.d(55): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, int, int)` +fail_compilation/fail332.d(55): expected 2 variadic argument(s), not 3 +--- +*/ +void bar(Object, int[2]...); + +void test2() +{ + bar(); + bar(4); + bar(null); + bar(null, 2); + bar(null, 2, ""); + bar(null, 2,3,4); } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail341.d b/gcc/testsuite/gdc.test/fail_compilation/fail341.d index af78e81..8677d48 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail341.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail341.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail341.d(26): Error: struct fail341.S is not copyable because it is annotated with @disable -fail_compilation/fail341.d(27): Error: function fail341.foo is not callable because it is annotated with @disable +fail_compilation/fail341.d(26): Error: struct fail341.S is not copyable because it is annotated with `@disable` +fail_compilation/fail341.d(27): Error: function `fail341.foo` cannot be used because it is annotated with `@disable` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail344.d b/gcc/testsuite/gdc.test/fail_compilation/fail344.d index 9173740..f395392 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail344.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail344.d @@ -1,4 +1,16 @@ -// 3737 +// https://issues.dlang.org/show_bug.cgi?id=3737 +/* +TEST_OUTPUT: +--- +fail_compilation/fail344.d(20): Error: undefined identifier `Q` +fail_compilation/fail344.d(20): Error: undefined identifier `Q` +fail_compilation/fail344.d(20): Error: undefined identifier `V` +fail_compilation/fail344.d(23): while evaluating: `static assert(Alike!(SIB!(crayon)))` +fail_compilation/fail344.d(23): Error: template instance `fail344.SIB!(crayon).SIB.Alike!(SIB!(crayon))` error instantiating +fail_compilation/fail344.d(23): while evaluating: `static assert(Alike!(SIB!(crayon)))` +fail_compilation/fail344.d(28): Error: template instance `fail344.SIB!(crayon).SIB.opDispatch!"E"` error instantiating +--- +*/ int crayon; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail346.d b/gcc/testsuite/gdc.test/fail_compilation/fail346.d index 532f0bf..af491bd 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail346.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail346.d @@ -1,3 +1,12 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail346.d(15): Error: undefined identifier `P` +fail_compilation/fail346.d(15): Error: variable `fail346.S.T!0.T` cannot use template to add field to aggregate `S` +fail_compilation/fail346.d(20): Error: template instance `fail346.S.T!0` error instantiating +fail_compilation/fail346.d(23): instantiated from here: `V!(S, 0)` +--- +*/ struct S { int x; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail347.d b/gcc/testsuite/gdc.test/fail_compilation/fail347.d index 03ae703..61718df 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail347.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail347.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/fail347.d(21): Error: undefined identifier `bbr`, did you mean variable `bar`? -fail_compilation/fail347.d(22): Error: no property 'ofo' for type 'S', did you mean 'foo'? +fail_compilation/fail347.d(22): Error: no property 'ofo' for type 'S', did you mean 'fail347.S.foo'? fail_compilation/fail347.d(23): Error: undefined identifier `strlenx`, did you mean function `strlen`? --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail356a.d b/gcc/testsuite/gdc.test/fail_compilation/fail356a.d index 4981f72..6375b5c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail356a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail356a.d @@ -1,2 +1,9 @@ +/* +EXTRA_FILES: imports/fail356.d +TEST_OUTPUT: +--- +fail_compilation/fail356a.d(9): Error: variable `fail356a.imports` conflicts with import `fail356a.imports` at fail_compilation/fail356a.d(8) +--- +*/ import imports.fail356; int imports; // collides with package name diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail356b.d b/gcc/testsuite/gdc.test/fail_compilation/fail356b.d index 18f6085..21f91b1 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail356b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail356b.d @@ -1,2 +1,9 @@ +/* +EXTRA_FILES: imports/fail356.d +TEST_OUTPUT: +--- +fail_compilation/fail356b.d(9): Error: variable `fail356b.bar` conflicts with alias `fail356b.bar` at fail_compilation/fail356b.d(8) +--- +*/ import imports.fail356 : bar; int bar; // collides with selective import diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail356c.d b/gcc/testsuite/gdc.test/fail_compilation/fail356c.d index ab12c90..bd10943 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail356c.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail356c.d @@ -1,2 +1,9 @@ +/* +EXTRA_FILES: imports/fail356.d +TEST_OUTPUT: +--- +fail_compilation/fail356c.d(9): Error: variable `fail356c.foo` conflicts with import `fail356c.foo` at fail_compilation/fail356c.d(8) +--- +*/ import foo = imports.fail356; int foo; // collides with renamed import diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3581a.d b/gcc/testsuite/gdc.test/fail_compilation/fail3581a.d index 5c44866..56e8c0c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3581a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3581a.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail3581a.d(9): Error: function `fail3581a.B.f` cannot override a non-virtual function +--- +*/ class A { void f() {} } class B : A { static override void f() {}; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3581b.d b/gcc/testsuite/gdc.test/fail_compilation/fail3581b.d index 38be322..c2f7f13 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3581b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3581b.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail3581b.d(9): Error: function `fail3581b.B.f` `private` method is not virtual and cannot override +--- +*/ class A { void f() {} } class B : A { private override void f() {}; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail359.d b/gcc/testsuite/gdc.test/fail_compilation/fail359.d index aae36c8..c6a23ad 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail359.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail359.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail359.d(8): Error: #line integer ["filespec"]\n expected +fail_compilation/fail359.d(9): Error: no identifier for declarator `_BOOM` +--- +*/ #line 5 _BOOM void main() { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3673a.d b/gcc/testsuite/gdc.test/fail_compilation/fail3673a.d index 92c23f0..889d940 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3673a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3673a.d @@ -1,2 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail3673a.d(8): Error: template constraints only allowed for templates +--- +*/ class A {} class B : A if(false) { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3673b.d b/gcc/testsuite/gdc.test/fail_compilation/fail3673b.d index 264b4ae..bf745ac 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3673b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3673b.d @@ -1,2 +1,12 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail3673b.d(12): Error: basic type expected, not `if` +fail_compilation/fail3673b.d(12): Error: template constraints only allowed for templates +fail_compilation/fail3673b.d(12): Error: { } expected following `class` declaration +fail_compilation/fail3673b.d(12): Error: no identifier for declarator `A` +fail_compilation/fail3673b.d(12): Error: declaration expected, not `{` +--- +*/ class A {} class B : if(false) A { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3731.d b/gcc/testsuite/gdc.test/fail_compilation/fail3731.d index 377fd49..c2903bb 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3731.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3731.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail3731.d(13): Error: cannot implicitly convert expression `x` of type `immutable(D)` to `fail3731.main.C` +--- +*/ void main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3753.d b/gcc/testsuite/gdc.test/fail_compilation/fail3753.d index 4855995..d20d8e9 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3753.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3753.d @@ -1,4 +1,5 @@ /* +TEST_OUTPUT: --- Error: cannot mix core.std.stdlib.alloca() and exception handling in _Dmain() --- diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3895.d b/gcc/testsuite/gdc.test/fail_compilation/fail3895.d index 9921f2a..3879ef5 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3895.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3895.d @@ -1,9 +1,14 @@ -import std.stdio; +/* +TEST_OUTPUT: +--- +fail_compilation/fail3895.d(12): Error: cannot append type `double[]` to type `float[]` +--- +*/ + void main() { double[] stuff = [1.,2.,3.,4.,5.]; float[] otherStuff; otherStuff ~= stuff; - writeln(otherStuff); } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4206.d b/gcc/testsuite/gdc.test/fail_compilation/fail4206.d index 409158a..b9c1671 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4206.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4206.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4206.d(9): Error: initializer must be an expression, not `s` +--- +*/ struct s {} enum var = s; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269a.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269a.d index 7794c46..6604f1f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4269a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269a.d @@ -1,3 +1,11 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4269a.d(12): Error: undefined identifier `B` +fail_compilation/fail4269a.d(12): Error: variable `fail4269a.A.blah` field not allowed in interface +fail_compilation/fail4269a.d(13): Error: undefined identifier `B` +--- +*/ enum bool WWW = is(typeof(A.x)); interface A { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269b.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269b.d index 2234cb8..2530133 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4269b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269b.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4269b.d(11): Error: undefined identifier `B` +fail_compilation/fail4269b.d(12): Error: undefined identifier `B` +--- +*/ enum bool WWW = is(typeof(A.x)); struct A { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269c.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269c.d index b00ec1b..8bbfaac 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4269c.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269c.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4269c.d(11): Error: undefined identifier `B` +fail_compilation/fail4269c.d(12): Error: undefined identifier `B` +--- +*/ enum bool WWW = is(typeof(A.x)); class A { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269d.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269d.d index b9d2afc..135e1d4 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4269d.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269d.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4269d.d(9): Error: undefined identifier `Y` +--- +*/ static if(is(typeof(X6.init))) {} alias Y X6; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269e.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269e.d index d7b2f23..c63bfac 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4269e.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269e.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4269e.d(10): Error: semicolon expected, not `X5` +fail_compilation/fail4269e.d(10): Error: no identifier for declarator `X5` +--- +*/ static if(is(typeof(X5.init))) {} typedef Y X5; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269f.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269f.d index 4033447..7a719c7 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4269f.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269f.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4269f.d(9): Error: `alias X16 = X16;` cannot alias itself, use a qualified name to create an overload set +--- +*/ static if(is(typeof(X16))) {} alias X16 X16; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269g.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269g.d index 9241e48..69d9a9a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4269g.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269g.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4269g.d(10): Error: alias `fail4269g.Xg` cannot alias an expression `d[1]` +--- +*/ int[2] d; static if(is(typeof(Xg.init))) {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375a.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375a.d index 030b485..5ee2a31 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375a.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375a.d(14): Warning: else is dangling, add { } after condition at fail_compilation/fail4375a.d(11) +--- +*/ void main() { if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375b.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375b.d index 6ac5b71..0d16446 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375b.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375b.d(16): Warning: else is dangling, add { } after condition at fail_compilation/fail4375b.d(12) +--- +*/ void main() { // disallowed diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375c.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375c.d index 697c99f..4e578aa 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375c.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375c.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375c.d(15): Warning: else is dangling, add { } after condition at fail_compilation/fail4375c.d(11) +--- +*/ void main() { if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375d.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375d.d index 329907e..8e9b4e7 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375d.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375d.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375d.d(15): Warning: else is dangling, add { } after condition at fail_compilation/fail4375d.d(11) +--- +*/ void main() { if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375e.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375e.d index 14b96d7..ae809bc 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375e.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375e.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375e.d(14): Warning: else is dangling, add { } after condition at fail_compilation/fail4375e.d(11) +--- +*/ void main() { version (A) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375f.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375f.d index c715ee6..5855b1b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375f.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375f.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375f.d(14): Warning: else is dangling, add { } after condition at fail_compilation/fail4375f.d(11) +--- +*/ void main() { version (A) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375g.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375g.d index f555651..4b9d12b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375g.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375g.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375g.d(14): Warning: else is dangling, add { } after condition at fail_compilation/fail4375g.d(11) +--- +*/ void main() { static if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375h.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375h.d index 793e42b..72e3e14 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375h.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375h.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375h.d(16): Warning: else is dangling, add { } after condition at fail_compilation/fail4375h.d(13) +--- +*/ void main() { switch (4) { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375i.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375i.d index da3e67c..5801c61 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375i.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375i.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375i.d(16): Warning: else is dangling, add { } after condition at fail_compilation/fail4375i.d(11) +--- +*/ void main() { if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375j.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375j.d index cd289a0..9a87540 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375j.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375j.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375j.d(16): Warning: else is dangling, add { } after condition at fail_compilation/fail4375j.d(11) +--- +*/ void main() { if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375k.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375k.d index f372406..bb8b7b2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375k.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375k.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375k.d-mixin-11(15): Warning: else is dangling, add { } after condition at fail_compilation/fail4375k.d-mixin-11(12) +--- +*/ void main() { mixin(q{ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375l.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375l.d index fea1d82..965b0e7 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375l.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375l.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375l.d(15): Warning: else is dangling, add { } after condition at fail_compilation/fail4375l.d(11) +--- +*/ void main() { if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375m.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375m.d index fdde1a1..a6bdf1e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375m.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375m.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375m.d(15): Warning: else is dangling, add { } after condition at fail_compilation/fail4375m.d(12) +--- +*/ void main() { do diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375o.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375o.d index 6c3d3e1..c37b219 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375o.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375o.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375o.d(15): Warning: else is dangling, add { } after condition at fail_compilation/fail4375o.d(11) +--- +*/ void main() { if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375p.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375p.d index 82f7cab..52a6e65 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375p.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375p.d @@ -1,5 +1,12 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375p.d(19): Warning: else is dangling, add { } after condition at fail_compilation/fail4375p.d(12) +fail_compilation/fail4375p.d(16): Error: undefined identifier `x` +--- +*/ void main() { if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375q.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375q.d index 7d11c46..f445eab 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375q.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375q.d @@ -1,5 +1,12 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375q.d(17): Warning: else is dangling, add { } after condition at fail_compilation/fail4375q.d(13) +fail_compilation/fail4375q.d(14): Error: `with` expressions must be aggregate types or pointers to them, not `int` +--- +*/ void main() { auto x = 1; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375r.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375r.d index 49b2f8a..61923e2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375r.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375r.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375r.d(17): Warning: else is dangling, add { } after condition at fail_compilation/fail4375r.d(11) +--- +*/ void main() { if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375s.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375s.d index ed1b725..cd4e5a0 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375s.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375s.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375s.d(17): Warning: else is dangling, add { } after condition at fail_compilation/fail4375s.d(11) +--- +*/ void main() { if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375t.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375t.d index 1975636..557761b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375t.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375t.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -unittest -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375t.d(14): Warning: else is dangling, add { } after condition at fail_compilation/fail4375t.d(11) +--- +*/ unittest { // disallowed if (true) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375u.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375u.d index cb06823..1028b78 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375u.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375u.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375u.d(13): Warning: else is dangling, add { } after condition at fail_compilation/fail4375u.d(11) +--- +*/ static if (true) static if (false) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375v.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375v.d index 1510c8d..f4a6089 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375v.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375v.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375v.d(13): Warning: else is dangling, add { } after condition at fail_compilation/fail4375v.d(11) +--- +*/ version (A) version (B) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375w.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375w.d index cd3c3bd..ae1ac21 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375w.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375w.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375w.d(13): Warning: else is dangling, add { } after condition at fail_compilation/fail4375w.d(11) +--- +*/ static if (true) version (B) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375x.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375x.d index b6ae64f..33c8eb2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375x.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375x.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375x.d(14): Warning: else is dangling, add { } after condition at fail_compilation/fail4375x.d(11) +--- +*/ static if (true) abstract: diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375y.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375y.d index b3713e3..bc79631 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4375y.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375y.d @@ -1,5 +1,11 @@ // REQUIRED_ARGS: -w -// 4375: Dangling else +// https://issues.dlang.org/show_bug.cgi?id=4375: Dangling else +/* +TEST_OUTPUT: +--- +fail_compilation/fail4375y.d(16): Warning: else is dangling, add { } after condition at fail_compilation/fail4375y.d(11) +--- +*/ static if (true) align(1) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4510.d b/gcc/testsuite/gdc.test/fail_compilation/fail4510.d index d101000..64a8d45 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4510.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4510.d @@ -1,4 +1,10 @@ -// 4510 +// https://issues.dlang.org/show_bug.cgi?id=4510 +/* +TEST_OUTPUT: +--- +fail_compilation/fail4510.d(12): Error: argument type mismatch, `float` to `ref double` +--- +*/ void main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4511.d b/gcc/testsuite/gdc.test/fail_compilation/fail4511.d index f4d8a1c..efe4d41 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4511.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4511.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4511.d(18): Error: cannot implicitly override base class method `fail4511.test72.X.func` with `fail4511.test72.Y.func`; add `override` attribute +--- +*/ void test72() { class A {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4517.d b/gcc/testsuite/gdc.test/fail_compilation/fail4517.d index a55b0f5..f3fe031 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4517.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4517.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4517.d(16): Error: `enum` member `B` not represented in `final switch` +--- +*/ enum E : ushort { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4611.d b/gcc/testsuite/gdc.test/fail_compilation/fail4611.d index f1547ba..02fcc2e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4611.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4611.d @@ -1,4 +1,5 @@ /* +TEST_OUTPUT: --- fail_compilation/fail4611.d(15): Error: Vec[2147483647] size 4 * 2147483647 exceeds 0x7fffffff size limit for static array --- diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail47.d b/gcc/testsuite/gdc.test/fail_compilation/fail47.d index d320fda..9da0c09 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail47.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail47.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail47.d(8): Error: variable `fail47._foo` is aliased to a function +--- +*/ void foo() {} int _foo; alias _foo foo; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4958.d b/gcc/testsuite/gdc.test/fail_compilation/fail4958.d index b723476..02bbc61 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail4958.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail4958.d @@ -1,2 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail4958.d(8): Error: enum member `fail4958.FloatEnum.B` has inexact value due to loss of precision +--- +*/ enum FloatEnum : float { A = float.max/2, B, C } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail53.d b/gcc/testsuite/gdc.test/fail_compilation/fail53.d index 2570dd8..556896c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail53.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail53.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail53.d(25): Error: function object.Object.opEquals (Object o) is not callable using argument types (int) +fail_compilation/fail53.d(26): Error: function `object.Object.opEquals(Object o)` is not callable using argument types `(int)` +fail_compilation/fail53.d(26): cannot pass argument `i` of type `int` to parameter `Object o` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5435.d b/gcc/testsuite/gdc.test/fail_compilation/fail5435.d index 2c610a8..fefed37 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail5435.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail5435.d @@ -1,4 +1,32 @@ -// 5435 +// https://issues.dlang.org/show_bug.cgi?id=5435 +/* +TEST_OUTPUT: +--- +Enum5435.A +Enum5435.B +Enum5435.C +fail_compilation/fail5435.d(38): Error: cannot implicitly convert expression `"foo"` of type `string` to `Enum5435` +fail_compilation/fail5435.d(38): while evaluating `pragma(msg, foo)` +fail_compilation/fail5435.d(38): Error: cannot implicitly convert expression `3.0` of type `double` to `Enum5435` +fail_compilation/fail5435.d(38): while evaluating `pragma(msg, foo)` +fail_compilation/fail5435.d(39): Error: cannot implicitly convert expression `Enum5435.A` of type `Enum5435` to `string` +fail_compilation/fail5435.d(39): while evaluating `pragma(msg, foo)` +fail_compilation/fail5435.d(39): Error: cannot implicitly convert expression `Enum5435.B` of type `Enum5435` to `string` +fail_compilation/fail5435.d(39): while evaluating `pragma(msg, foo)` +fail_compilation/fail5435.d(39): Error: cannot implicitly convert expression `Enum5435.C` of type `Enum5435` to `string` +fail_compilation/fail5435.d(39): while evaluating `pragma(msg, foo)` +foo +fail_compilation/fail5435.d(39): Error: cannot implicitly convert expression `3.0` of type `double` to `string` +fail_compilation/fail5435.d(39): while evaluating `pragma(msg, foo)` +0 +1 +2 +fail_compilation/fail5435.d(40): Error: cannot implicitly convert expression `"foo"` of type `string` to `int` +fail_compilation/fail5435.d(40): while evaluating `pragma(msg, foo)` +fail_compilation/fail5435.d(40): Error: cannot implicitly convert expression `3.0` of type `double` to `int` +fail_compilation/fail5435.d(40): while evaluating `pragma(msg, foo)` +--- +*/ template Tuple5435(E...) { alias E Tuple5435; } enum Enum5435 { A, B, C }; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail55.d b/gcc/testsuite/gdc.test/fail_compilation/fail55.d index 57117d8..290c2b66 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail55.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail55.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail55.d(22): Error: function object.Object.opCmp (Object o) is not callable using argument types (int) +fail_compilation/fail55.d(23): Error: function `object.Object.opCmp(Object o)` is not callable using argument types `(int)` +fail_compilation/fail55.d(23): cannot pass argument `0` of type `int` to parameter `Object o` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail56.d b/gcc/testsuite/gdc.test/fail_compilation/fail56.d index 579401f..64902fe 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail56.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail56.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail56.d(21): Error: mixin `dstress.nocompile.bug_20050330_A.main.Blah!(5, a).Blah!(5, a)` recursive mixin instantiation +fail_compilation/fail56.d(26): Error: mixin `dstress.nocompile.bug_20050330_A.main.Blah!(5, a)` error instantiating +--- +*/ // $HeadURL$ // $Date$ // $Author$ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5634.d b/gcc/testsuite/gdc.test/fail_compilation/fail5634.d index 0044adf..e2442e6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail5634.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail5634.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +---- +fail_compilation/fail5634.d(9): Error: function `D main()` conflicts with previous declaration at fail_compilation/fail5634.d(8) +--- +*/ + void main() { } void main() { } - diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail57.d b/gcc/testsuite/gdc.test/fail_compilation/fail57.d index ded3a6e..41149cd 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail57.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail57.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail57.d(11): Error: divide by 0 +fail_compilation/fail57.d(11): Error: divide by 0 +--- +*/ int main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5733.d b/gcc/testsuite/gdc.test/fail_compilation/fail5733.d index 2292716..d58b362 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail5733.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail5733.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail5733.d(12): Error: `opDispatch!"foo"` isn't a template +--- +*/ struct Test { struct opDispatch(string dummy) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail58.d b/gcc/testsuite/gdc.test/fail_compilation/fail58.d index ad6f8da..29d9e58 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail58.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail58.d @@ -1,3 +1,12 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail58.d(26): Error: function `fail58.SomeFunc(dchar[] pText, out int pStopPosn)` is not callable using argument types `(string, int)` +fail_compilation/fail58.d(26): cannot pass argument `"123"` of type `string` to parameter `dchar[] pText` +fail_compilation/fail58.d(30): Error: function `fail58.SomeFunc(dchar[] pText, out int pStopPosn)` is not callable using argument types `(string, int)` +fail_compilation/fail58.d(30): cannot pass argument `""` of type `string` to parameter `dchar[] pText` +--- +*/ debug(1) import std.stdio; const int anything = -1000; // Line #2 dchar[] SomeFunc( dchar[] pText, out int pStopPosn) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5851.d b/gcc/testsuite/gdc.test/fail_compilation/fail5851.d index c422c14..236a956 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail5851.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail5851.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail5851.d(11): Error: alias this is not reachable as `Foo` already converts to `object.Object` +--- +*/ class Foo { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5953a1.d b/gcc/testsuite/gdc.test/fail_compilation/fail5953a1.d index f977c58..cd64e74 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail5953a1.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail5953a1.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail5953a1.d(9): Error: expression expected, not `,` +--- +*/ void main() { auto a2 = [,]; // invalid, but compiles diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5953a2.d b/gcc/testsuite/gdc.test/fail_compilation/fail5953a2.d index a1e6c75..2edbc10 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail5953a2.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail5953a2.d @@ -1,3 +1,11 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail5953a2.d(11): Error: expression expected, not `,` +fail_compilation/fail5953a2.d(11): Error: expression expected, not `,` +fail_compilation/fail5953a2.d(11): Error: expression expected, not `,` +--- +*/ void main() { auto a3 = [,,,]; // invalid, but compiles diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5953s1.d b/gcc/testsuite/gdc.test/fail_compilation/fail5953s1.d index c64601b..275c3f9 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail5953s1.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail5953s1.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail5953s1.d(10): Error: expression expected, not `,` +--- +*/ void main() { struct S{} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5953s2.d b/gcc/testsuite/gdc.test/fail_compilation/fail5953s2.d index 3f1ac9c..d66ff5d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail5953s2.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail5953s2.d @@ -1,3 +1,11 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail5953s2.d(12): Error: expression expected, not `,` +fail_compilation/fail5953s2.d(12): Error: expression expected, not `,` +fail_compilation/fail5953s2.d(12): Error: expression expected, not `,` +--- +*/ void main() { struct S{} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail60.d b/gcc/testsuite/gdc.test/fail_compilation/fail60.d index 3d66025..ec8de0b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail60.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail60.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail60.d(14): Error: `this` is only defined in non-static member functions, not `A` +--- +*/ class A { class B diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6029.d b/gcc/testsuite/gdc.test/fail_compilation/fail6029.d index e5199db..45797eb 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail6029.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail6029.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail6029.d(10): Error: alias this is not reachable as `A` already converts to `A` +--- +*/ struct A { static A a; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6242.d b/gcc/testsuite/gdc.test/fail_compilation/fail6242.d index 92df770..08f5de3 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail6242.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail6242.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail6242.d(9): Error: cannot implicitly override base class method `fail6242.A.fun` with `fail6242.B.fun`; add `override` attribute +--- +*/ class A { void fun(int) {} } class B : A { void fun(int x) in { assert(x > 0); } body {} } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6458.d b/gcc/testsuite/gdc.test/fail_compilation/fail6458.d index 52b97a3..218de0d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail6458.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail6458.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail6458.d(10): Error: Invalid trailing code unit +--- +*/ void main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6497.d b/gcc/testsuite/gdc.test/fail_compilation/fail6497.d index d985cb4..3ac90b5 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail6497.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail6497.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail6497.d(12): Error: cannot take address of local `n` in `@safe` function `main` +fail_compilation/fail6497.d(12): Error: cannot take address of local `n` in `@safe` function `main` +--- +*/ void main() @safe { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6561.d b/gcc/testsuite/gdc.test/fail_compilation/fail6561.d index 8a9da8b..456ef0d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail6561.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail6561.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail6561.d(9): Error: undefined identifier `x` +--- +*/ struct S { alias x this; // should cause undefined identifier error diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6611.d b/gcc/testsuite/gdc.test/fail_compilation/fail6611.d index 7816889..26587dc 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail6611.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail6611.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail6611.d(11): Error: cannot post-increment array slice `x[]`, use pre-increment instead +--- +*/ void main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6781.d b/gcc/testsuite/gdc.test/fail_compilation/fail6781.d index ef1c77f..174ca3d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail6781.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail6781.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail6781.d(9): Error: undefined identifier `some_error` +fail_compilation/fail6781.d(14): Error: template instance `fail6781.C6781.makeSortedIndices.bug6781!(greater)` error instantiating +--- +*/ void bug6781(alias xxx)() { some_error; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6968.d b/gcc/testsuite/gdc.test/fail_compilation/fail6968.d index 69f63b9..b56a5db 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail6968.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail6968.d @@ -1,4 +1,14 @@ -// 6968 +// https://issues.dlang.org/show_bug.cgi?id=6968 +/* +TEST_OUTPUT: +--- +fail_compilation/fail6968.d(26): Error: cannot pass type `int` as a function argument +fail_compilation/fail6968.d(26): Error: cannot pass type `long` as a function argument +fail_compilation/fail6968.d(26): Error: circular initialization of variable `fail6968.PredAny!(int, long, float).PredAny` +fail_compilation/fail6968.d(31): Error: template instance `fail6968.PredAny!(int, long, float)` error instantiating +fail_compilation/fail6968.d(31): while evaluating `pragma(msg, PredAny!(int, long, float))` +--- +*/ template Pred(A, B) { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7173.d b/gcc/testsuite/gdc.test/fail_compilation/fail7173.d index 2f6c748..05ba7f9 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7173.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7173.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7173.d(23): Error: expression `b1._a.opBinary(b2._a).fun()` is `void` and has no value +--- +*/ struct A{ A opBinary(string op)(A a){ A rt; return rt; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7178.d b/gcc/testsuite/gdc.test/fail_compilation/fail7178.d index 04a1018..8540249 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7178.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7178.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7178.d(10): Error: undefined identifier `contents` in module `fail7178` +fail_compilation/fail7178.d(12): Error: mixin `fail7178.populate!int` error instantiating +--- +*/ template populate(overloads...) { mixin populate!(.contents); diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7234.d b/gcc/testsuite/gdc.test/fail_compilation/fail7234.d index e8ddd4e..f38308d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7234.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7234.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7234.d(14): Error: no property `empty` for type `Contract*`, perhaps `import std.range;` is needed? +--- +*/ struct Contract { void opDispatch()(){} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7369.d b/gcc/testsuite/gdc.test/fail_compilation/fail7369.d index b54757d..f17dc96 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7369.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7369.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7369.d(9): Error: cannot modify `this.a` in `const` function +--- +*/ struct S7369 { int a; invariant() { a += 5; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d index d358b60..c3fc311 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7424b.d(10): Error: template `this.g()()` has no value +--- +*/ struct S7424b { @property int g()() { return 0; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d index c067178..220c995 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7424c.d(10): Error: template `this.g()()` has no value +--- +*/ struct S7424c { @property int g()() { return 0; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d index a981be6..669c9ff 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7424d.d(10): Error: template `this.g()()` has no value +--- +*/ struct S7424d { @property int g()() immutable { return 0; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d index 4dfda62..18bf414 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7424e.d(10): Error: template `this.g()()` has no value +--- +*/ struct S7424e { @property int g()() immutable { return 0; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d index e72a05b..29e0ecc 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7424f.d(10): Error: template `this.g()()` has no value +--- +*/ struct S7424f { @property int g()() shared { return 0; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d index 059f586..b4670de 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7424g.d(10): Error: template `this.g()()` has no value +--- +*/ struct S7424g { @property int g()() { return 0; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d index fd22b2e..b76f5b3 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7424h.d(10): Error: template `this.g()()` has no value +--- +*/ struct S7424g { @property int g()() { return 0; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d index 2871e93..887c859 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7424i.d(10): Error: template `this.g()()` has no value +--- +*/ struct S7424g { @property int g()() immutable { return 0; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7524a.d b/gcc/testsuite/gdc.test/fail_compilation/fail7524a.d index 6f1ebef..834c315 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7524a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7524a.d @@ -1,4 +1,10 @@ - -// 7524 +/* +REQUIRED_ARGS: -o- +TEST_OUTPUT: +---- +fail_compilation/fail7524a.d(10): Error: #line integer ["filespec"]\n expected +fail_compilation/fail7524a.d(10): Error: declaration expected, not `"$r:\w+ +\d+ \d+$"` +---- +*/ #line 47 __DATE__ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7524b.d b/gcc/testsuite/gdc.test/fail_compilation/fail7524b.d index 042baf5..f462746 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7524b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7524b.d @@ -1,3 +1,10 @@ -// 7524 +// https://issues.dlang.org/show_bug.cgi?id=7524 +/* +TEST_OUTPUT: +--- +fail_compilation/fail7524b.d(10): Error: #line integer ["filespec"]\n expected +fail_compilation/fail7524b.d(10): Error: declaration expected, not `$n$L` +--- +*/ #line 47 __VERSION__ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7603a.d b/gcc/testsuite/gdc.test/fail_compilation/fail7603a.d index e1d28ea..76a92c2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7603a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7603a.d @@ -1 +1,7 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7603a.d(7): Error: cannot modify constant `true` +--- +*/ void test(ref bool val = true) { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7603b.d b/gcc/testsuite/gdc.test/fail_compilation/fail7603b.d index 5317072..9b84d3f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7603b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7603b.d @@ -1 +1,7 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7603b.d(7): Error: cannot modify constant `true` +--- +*/ void test(out bool val = true) { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7603c.d b/gcc/testsuite/gdc.test/fail_compilation/fail7603c.d index f5f6e18..25a7399 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7603c.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7603c.d @@ -1,2 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7603c.d(8): Error: cannot modify constant `3` +--- +*/ enum x = 3; void test(ref int val = x) { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail77.d b/gcc/testsuite/gdc.test/fail_compilation/fail77.d index 79ada70..687b0ad 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail77.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail77.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail77.d(11): Error: cannot cast expression `& i` of type `int*` to `ubyte[4]` +--- +*/ void test() { int i; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7702.d b/gcc/testsuite/gdc.test/fail_compilation/fail7702.d index 8b7ae21..4638c0b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7702.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7702.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7702.d(14): Error: `s.opDispatch!"x"` isn't a template +--- +*/ struct S { template opDispatch (string name) {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7751.d b/gcc/testsuite/gdc.test/fail_compilation/fail7751.d index e367d0e..87143fa 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7751.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7751.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7751.d(15): Error: no constructor for `Foo` +fail_compilation/fail7751.d(23): Error: template instance `fail7751.foo!int` error instantiating +--- +*/ class Foo(T) { T x; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7851.d b/gcc/testsuite/gdc.test/fail_compilation/fail7851.d index 7ede41f..f5d9ea3 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7851.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7851.d @@ -1,4 +1,12 @@ -// 7851 +// https://issues.dlang.org/show_bug.cgi?id=7851 +/* +TEST_OUTPUT: +--- +fail_compilation/fail7851.d(38): Error: need `this` for `__mem_field_0` of type `int` +fail_compilation/fail7851.d(38): Error: need `this` for `__mem_field_1` of type `long` +fail_compilation/fail7851.d(38): Error: need `this` for `__mem_field_2` of type `float` +--- +*/ template TypeTuple(TList...) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7859.d b/gcc/testsuite/gdc.test/fail_compilation/fail7859.d index 436d3a3..ef8b770 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7859.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7859.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7859.d(9): Error: undefined identifier `NonExistent` +--- +*/ template A(alias B) {} mixin template C(alias B = cast(NonExistent)null) { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7861.d b/gcc/testsuite/gdc.test/fail_compilation/fail7861.d index ce59e8e..e3a2d08 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail7861.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail7861.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail7861.d(17): Error: no property `nonexistent` for type `test.B` +--- +*/ module test; mixin template A() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail79.d b/gcc/testsuite/gdc.test/fail_compilation/fail79.d index 46581d9..da06984 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail79.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail79.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail79.d(13): Error: incompatible types for ((& a) + (& b)): 'int*' and 'int*' +fail_compilation/fail79.d(13): Error: incompatible types for ((& a) + (& b)): both operands are of type 'int*' --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8009.d b/gcc/testsuite/gdc.test/fail_compilation/fail8009.d index 1af7e2c..19a0712 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail8009.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail8009.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail8009.d(9): Error: template `fail8009.filter` cannot deduce function from argument types `!()(void)`, candidates are: +fail_compilation/fail8009.d(8): `filter(R)(scope bool delegate(ref BAD!R) func)` +--- +*/ void filter(R)(scope bool delegate(ref BAD!R) func) { } void main() { filter(r => r); } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8032.d b/gcc/testsuite/gdc.test/fail_compilation/fail8032.d index a328181..9f6dc40 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail8032.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail8032.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail8032.d(19): Error: function `fail8032.B.f` cannot determine overridden function +--- +*/ mixin template T() { void f() { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8313.d b/gcc/testsuite/gdc.test/fail_compilation/fail8313.d index 9dec1bd..2badeff 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail8313.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail8313.d @@ -1,3 +1,13 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail8313.d(13): Error: `fail8313.bar` called with argument types `(int)` matches both: +fail_compilation/fail8313.d(11): `fail8313.bar!().bar(int x)` +and: +fail_compilation/fail8313.d(12): `fail8313.bar!().bar(int x)` +fail_compilation/fail8313.d(13): while evaluating: `static assert(bar()(int x)(1))` +--- +*/ auto bar()(int x){return x;} auto bar()(int x = bar()){return x;} static assert(bar(1)); diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8691.d b/gcc/testsuite/gdc.test/fail_compilation/fail8691.d index e1979bb..8e46023 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail8691.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail8691.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail8691.d(7): Error: struct `fail8691.Foo` cannot have field `f` with static array of same struct type +--- +*/ struct Foo { Foo[1] f; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9301.d b/gcc/testsuite/gdc.test/fail_compilation/fail9301.d index bd7e952..eee7270 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail9301.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail9301.d @@ -1,6 +1,9 @@ /* -REQUIRED_ARGS: -o- -PERMUTE_ARGS: +REQUIRED_ARGS: -m64 -o- +TEST_OUTPUT: +--- +fail_compilation/fail9301.d(11): Error: cannot implicitly convert expression `0` of type `int` to `__vector(void[16])` +--- */ void main() diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9346.d b/gcc/testsuite/gdc.test/fail_compilation/fail9346.d index d3c7a59..57d420f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail9346.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail9346.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail9346.d(26): Error: struct fail9346.S is not copyable because it is annotated with @disable -fail_compilation/fail9346.d(27): Error: struct fail9346.S is not copyable because it is annotated with @disable +fail_compilation/fail9346.d(26): Error: struct fail9346.S is not copyable because it is annotated with `@disable` +fail_compilation/fail9346.d(27): Error: struct fail9346.S is not copyable because it is annotated with `@disable` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail94.d b/gcc/testsuite/gdc.test/fail_compilation/fail94.d index 23fef93..335b695 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail94.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail94.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail94.d(28): Error: cannot implicitly override base class method `fail94.A.clone` with `fail94.B.clone`; add `override` attribute +--- +*/ interface I { int foo(); diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9613.d b/gcc/testsuite/gdc.test/fail_compilation/fail9613.d index 18a18cc..7f9d007 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail9613.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail9613.d @@ -1,4 +1,11 @@ // PREMUTE_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/fail9613.d(12): Error: `(arguments)` expected following `const(byte)` +fail_compilation/fail9613.d(12): Error: semicolon expected following auto declaration, not `.` +--- +*/ void main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9766.d b/gcc/testsuite/gdc.test/fail_compilation/fail9766.d index d75d1bc..58cabe3 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail9766.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail9766.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail9766.d(14): Error: cannot interpret Foo!int at compile time +fail_compilation/fail9766.d(14): Error: integer constant expression expected instead of `Foo!int` +fail_compilation/fail9766.d(14): Error: alignment must be an integer positive power of 2, not Foo!int fail_compilation/fail9766.d(17): Error: alignment must be an integer positive power of 2, not -1 fail_compilation/fail9766.d(20): Error: alignment must be an integer positive power of 2, not 0 fail_compilation/fail9766.d(23): Error: alignment must be an integer positive power of 2, not 3 @@ -9,6 +10,7 @@ fail_compilation/fail9766.d(26): Error: alignment must be an integer positive po --- */ +#line 12 template Foo(T) {} align(Foo!int) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail99.d b/gcc/testsuite/gdc.test/fail_compilation/fail99.d index da87ed6..c147b81 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail99.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail99.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail99.d(12): Error: delegate dg (int) is not callable using argument types () +fail_compilation/fail99.d(13): Error: delegate `dg(int)` is not callable using argument types `()` +fail_compilation/fail99.d(13): missing argument for parameter #1: `int` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_compilation.exp b/gcc/testsuite/gdc.test/fail_compilation/fail_compilation.exp index c560308..cd65d7b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail_compilation.exp +++ b/gcc/testsuite/gdc.test/fail_compilation/fail_compilation.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Free Software Foundation, Inc. +# Copyright (C) 2020-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_contracts1.d b/gcc/testsuite/gdc.test/fail_compilation/fail_contracts1.d new file mode 100644 index 0000000..572b821 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail_contracts1.d @@ -0,0 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail_contracts1.d(8): Error: `(identifier) { ... }` or `(identifier; expression)` following `out` expected, not `)` +--- +*/ + +void foo() out()){} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_contracts2.d b/gcc/testsuite/gdc.test/fail_compilation/fail_contracts2.d new file mode 100644 index 0000000..2a07a60 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail_contracts2.d @@ -0,0 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail_contracts2.d(8): Error: missing `do { ... }` after `in` or `out` +--- +*/ + +void foo()in{}{} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_contracts3.d b/gcc/testsuite/gdc.test/fail_compilation/fail_contracts3.d new file mode 100644 index 0000000..de3e9bb --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail_contracts3.d @@ -0,0 +1,14 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail_contracts3.d(13): Error: function `fail_contracts3.D.foo` cannot have an in contract when overridden function `fail_contracts3.C.foo` does not have an in contract +--- +*/ + +class C { + void foo(){} +} + +class D : C { + override void foo()in{}do{} +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_contracts4.d b/gcc/testsuite/gdc.test/fail_compilation/fail_contracts4.d new file mode 100644 index 0000000..f1b6644 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail_contracts4.d @@ -0,0 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail_contracts4.d(8): Error: missing `do { ... }` for function literal +--- +*/ + +enum x = delegate int()in(true) out(;true) out(r; true) in{} out(r){}; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_isZeroInit.d b/gcc/testsuite/gdc.test/fail_compilation/fail_isZeroInit.d new file mode 100644 index 0000000..a352984 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail_isZeroInit.d @@ -0,0 +1,12 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail_isZeroInit.d(11): Error: type expected as second argument of __traits `isZeroInit` instead of `a` +--- +*/ +void test() +{ + int a = 3; + // Providing a specific variable rather than a type isn't allowed. + enum bool az = __traits(isZeroInit, a); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/failinout1.d b/gcc/testsuite/gdc.test/fail_compilation/failinout1.d index fc3d791..aa7a4b6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/failinout1.d +++ b/gcc/testsuite/gdc.test/fail_compilation/failinout1.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/failinout1.d(9): Error: cannot modify `inout` expression `x` +--- +*/ inout(int) foo(inout(int) x) { x = 5; // cannot modify inout diff --git a/gcc/testsuite/gdc.test/fail_compilation/failinout2.d b/gcc/testsuite/gdc.test/fail_compilation/failinout2.d index 12a9c44..e155363 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/failinout2.d +++ b/gcc/testsuite/gdc.test/fail_compilation/failinout2.d @@ -1 +1,7 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/failinout2.d(7): Error: variable `failinout2.x` only parameters or stack based variables can be `inout` +--- +*/ inout int x; diff --git a/gcc/testsuite/gdc.test/fail_compilation/failinout3748a.d b/gcc/testsuite/gdc.test/fail_compilation/failinout3748a.d index bb2cd55..77edb7e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/failinout3748a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/failinout3748a.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/failinout3748a.d(9): Error: variable `failinout3748a.S3748.err8` only parameters or stack based variables can be `inout` +--- +*/ struct S3748 { inout(int) err8; diff --git a/gcc/testsuite/gdc.test/fail_compilation/failinout3748b.d b/gcc/testsuite/gdc.test/fail_compilation/failinout3748b.d index 741e44f..b6dddd8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/failinout3748b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/failinout3748b.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/failinout3748b.d(9): Error: variable `failinout3748b.main.err11` `inout` variables can only be declared inside `inout` functions +--- +*/ void main() { inout(int)* err11; diff --git a/gcc/testsuite/gdc.test/fail_compilation/failsafea.d b/gcc/testsuite/gdc.test/fail_compilation/failsafea.d index b2a3f22..e121bda 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/failsafea.d +++ b/gcc/testsuite/gdc.test/fail_compilation/failsafea.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/failsafea.d(14): Error: `@safe` function `failsafea.callingsystem` cannot call `@system` function `failsafea.systemfunc` +fail_compilation/failsafea.d(9): `failsafea.systemfunc` is declared here +--- +*/ void systemfunc() @system {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/failsafeb.d b/gcc/testsuite/gdc.test/fail_compilation/failsafeb.d index c04d9ee..6af6b6f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/failsafeb.d +++ b/gcc/testsuite/gdc.test/fail_compilation/failsafeb.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/failsafeb.d(13): Error: `@safe` function `failsafeb.callingsystem` cannot call `@system` function pointer `sysfuncptr` +--- +*/ void function() @system sysfuncptr; diff --git a/gcc/testsuite/gdc.test/fail_compilation/failsafec.d b/gcc/testsuite/gdc.test/fail_compilation/failsafec.d index 8bcda91..4446e76 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/failsafec.d +++ b/gcc/testsuite/gdc.test/fail_compilation/failsafec.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/failsafec.d(13): Error: `@safe` function `failsafec.callingsystem` cannot call `@system` delegate `sysdelegate` +--- +*/ void delegate() @system sysdelegate; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fix21585.d b/gcc/testsuite/gdc.test/fail_compilation/fix21585.d new file mode 100644 index 0000000..48c74cb --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fix21585.d @@ -0,0 +1,19 @@ +/* https://issues.dlang.org/show_bug.cgi?id=21585 +TEST_OUTPUT: +--- +fail_compilation/fix21585.d(103): Error: expected 1 arguments for `toType` but had 0 +fail_compilation/fix21585.d(104): Error: expression expected as second argument of __traits `toType` +fail_compilation/fix21585.d(105): Error: `string` expected for __traits(toType, string), not `(1)` of type `int` +fail_compilation/fix21585.d(106): Error: cannot determine `__traits(toType, "hello betty")` +--- +*/ + +#line 100 + +template Type(T) { alias Type = T; } + +alias T1 = Type!(__traits(toType)); +alias T2 = Type!(__traits(toType, int)); +alias T3 = Type!(__traits(toType, 1)); +alias T4 = Type!(__traits(toType, "hello betty")); + diff --git a/gcc/testsuite/gdc.test/fail_compilation/fix350a.d b/gcc/testsuite/gdc.test/fail_compilation/fix350a.d index 8c3563c..2d60a00 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fix350a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fix350a.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fix350a.d(12): Error: comma expected separating field initializers +fail_compilation/fix350a.d(12): Error: comma expected separating field initializers +--- +*/ struct S1 { int a, b, c; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fix350b.d b/gcc/testsuite/gdc.test/fail_compilation/fix350b.d index 6c1a0bc..8ec428f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fix350b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fix350b.d @@ -1,3 +1,11 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fix350b.d(15): Error: comma expected separating field initializers +fail_compilation/fix350b.d(15): Error: comma expected separating field initializers +fail_compilation/fix350b.d(16): Error: comma expected separating field initializers +--- +*/ int foo() { return 3; } struct S2 diff --git a/gcc/testsuite/gdc.test/fail_compilation/format.d b/gcc/testsuite/gdc.test/fail_compilation/format.d new file mode 100644 index 0000000..3a24227 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/format.d @@ -0,0 +1,44 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/format.d(101): Error: function `format.printf1` `pragma(printf)` functions must be `extern(C) void printf1([parameters...], const(char)*, ...)` not `void(const(char)*, ...)` +fail_compilation/format.d(102): Error: function `format.printf2` `pragma(printf)` functions must be `extern(C) int printf2([parameters...], const(char)*, ...)` not `extern (C) int(const(int)*, ...)` +fail_compilation/format.d(103): Error: function `format.printf3` `pragma(printf)` functions must be `extern(C) int printf3([parameters...], const(char)*, va_list)` +fail_compilation/format.d(104): Error: function `format.printf4` `pragma(printf)` functions must be `extern(C) int printf4([parameters...], const(char)*, ...)` not `extern (C) int(const(char)*, int, ...)` +--- + */ + +#line 100 + +pragma(printf) void printf1(const(char)*, ...); +pragma(printf) extern (C) int printf2(const(int )*, ...); +pragma(printf) extern (C) int printf3(const(char)*); +pragma(printf) extern (C) int printf4(const(char)*, int, ...); + +pragma(printf) extern (C) int printf5(const(char)*, ...); +pragma(printf) extern (C) int printf6(immutable(char)*, ...); +pragma(printf) extern (C) int printf7(char*, ...); + +/* +TEST_OUTPUT: +--- +fail_compilation/format.d(203): Error: function `format.vprintf1` `pragma(printf)` functions must be `extern(C) void vprintf1([parameters...], const(char)*, va_list)` +fail_compilation/format.d(204): Error: function `format.vprintf2` `pragma(printf)` functions must be `extern(C) int vprintf2([parameters...], const(char)*, va_list)` +fail_compilation/format.d(205): Error: function `format.vprintf3` `pragma(printf)` functions must be `extern(C) int vprintf3([parameters...], const(char)*, va_list)` +fail_compilation/format.d(206): Error: function `format.vprintf4` `pragma(printf)` functions must be `extern(C) int vprintf4([parameters...], const(char)*, va_list)` +--- + */ + +#line 200 + +import core.stdc.stdarg; + +pragma(printf) void vprintf1(const(char)*, va_list); +pragma(printf) extern (C) int vprintf2(const(int )*, va_list); +pragma(printf) extern (C) int vprintf3(const(char)*); +pragma(printf) extern (C) int vprintf4(const(char)*, int, va_list); + +pragma(printf) extern (C) int vprintf5(const(char)*, va_list); +pragma(printf) extern (C) int vprintf6(immutable(char)*, va_list); +pragma(printf) extern (C) int vprintf7(char*, va_list); + diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10273.d b/gcc/testsuite/gdc.test/fail_compilation/ice10273.d index b7983bb..763fc06 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice10273.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice10273.d @@ -1,4 +1,14 @@ -// 10273 - ICE in CTFE +// https://issues.dlang.org/show_bug.cgi?id=10273 +// ICE in CTFE +/* +TEST_OUTPUT: +--- +fail_compilation/ice10273.d(14): Error: cannot implicitly convert expression `3.45` of type `double` to `int` +fail_compilation/ice10273.d(13): Error: CTFE failed because of previous errors in `Bug10273.init` +fail_compilation/ice10273.d(22): called from here: `bug10273()` +fail_compilation/ice10273.d(22): while evaluating: `static assert(bug10273())` +--- +*/ struct Bug10273 { int val = 3.45; diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10283.d b/gcc/testsuite/gdc.test/fail_compilation/ice10283.d index 347ac35..f52b8a2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice10283.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice10283.d @@ -1,4 +1,10 @@ -// 10283 +// https://issues.dlang.org/show_bug.cgi?id=10283 +/* +TEST_OUTPUT: +--- +fail_compilation/ice10283.d(14): Error: cannot implicitly convert expression `7` of type `int` to `string` +--- +*/ S10283 blah(S10283 xxx) { return xxx; } S10283 repy = blah(S10283()); diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10598.d b/gcc/testsuite/gdc.test/fail_compilation/ice10598.d new file mode 100644 index 0000000..ba6cdf7 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/ice10598.d @@ -0,0 +1,10 @@ +// REQUIRED_ARGS: -de +// EXTRA_SOURCES: imports/ice10598a.d imports/ice10598b.d +/* TEST_OUTPUT: +--- +fail_compilation/imports/ice10598a.d(5): Deprecation: module imports.ice10598b is not accessible here, perhaps add 'static import imports.ice10598b;' +fail_compilation/imports/ice10598a.d(5): Deprecation: module imports.ice10598b is not accessible here, perhaps add 'static import imports.ice10598b;' +--- +*/ + +void main() {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10599.d b/gcc/testsuite/gdc.test/fail_compilation/ice10599.d index b8be25a..6e9649c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice10599.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice10599.d @@ -1,4 +1,13 @@ -// 10599 ICE(interpret.c) +// https://issues.dlang.org/show_bug.cgi?id=10599 +// ICE(interpret.c) +/* +TEST_OUTPUT: +--- +fail_compilation/ice10599.d(13): Error: cannot implicitly convert expression `3.45` of type `double` to `int` +fail_compilation/ice10599.d(21): called from here: `bug10599()` +fail_compilation/ice10599.d(21): while evaluating: `static assert(bug10599())` +--- +*/ struct Bug { int val = 3.45; @@ -9,4 +18,4 @@ int bug10599() return 1; } -static assert(bug10599());
\ No newline at end of file +static assert(bug10599()); diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10770.d b/gcc/testsuite/gdc.test/fail_compilation/ice10770.d deleted file mode 100644 index 5b0659a..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/ice10770.d +++ /dev/null @@ -1,13 +0,0 @@ -/* -TEST_OUTPUT: ---- -fail_compilation/ice10770.d(13): Error: enum ice10770.E2 is forward referenced looking for base type -fail_compilation/ice10770.d(13): while evaluating: `static assert(is(E2 e == enum))` ---- -*/ - -enum E1 : int; -static assert(is(E1 e == enum) && is(e == int)); - -enum E2; -static assert(is(E2 e == enum)); diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10922.d b/gcc/testsuite/gdc.test/fail_compilation/ice10922.d index 1ddad18..9eeb622 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice10922.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice10922.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/ice10922.d(9): Error: function ice10922.__lambda4 (const(uint) n) is not callable using argument types () +fail_compilation/ice10922.d(10): Error: function `ice10922.__lambda4(const(uint) n)` is not callable using argument types `()` +fail_compilation/ice10922.d(10): missing argument for parameter #1: `const(uint) n` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11963.d b/gcc/testsuite/gdc.test/fail_compilation/ice11963.d index 9046f09..39eb120 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice11963.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice11963.d @@ -1 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice11963.d(10): Error: unexpected `(` in declarator +fail_compilation/ice11963.d(10): Error: identifier expected for template type parameter +fail_compilation/ice11963.d(10): Error: no identifier for declarator `A` +fail_compilation/ice11963.d(10): Error: declaration expected, not `""` +--- +*/ A("")= diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11965.d b/gcc/testsuite/gdc.test/fail_compilation/ice11965.d index 8c036ee..c8db60f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice11965.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice11965.d @@ -1 +1,14 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice11965.d(15): Error: no identifier for declarator `b*` +fail_compilation/ice11965.d(15): Error: found `End of File` when expecting `}` following compound statement +fail_compilation/ice11965.d(15): Error: found `End of File` when expecting `]` +fail_compilation/ice11965.d(15): Error: no identifier for declarator `u[() +{ +b* A; +} +]` +--- +*/ u[{b*A, diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11967.d b/gcc/testsuite/gdc.test/fail_compilation/ice11967.d index 93b8130..a3bda63 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice11967.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice11967.d @@ -1 +1,12 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice11967.d(12): Error: use `@(attributes)` instead of `[attributes]` +fail_compilation/ice11967.d(12): Error: expression expected, not `%` +fail_compilation/ice11967.d(12): Error: found `g` when expecting `)` +fail_compilation/ice11967.d(12): Error: found `{` when expecting `]` +fail_compilation/ice11967.d(13): Error: `@identifier` or `@(ArgumentList)` expected, not `@End of File` +fail_compilation/ice11967.d(13): Error: declaration expected following attribute, not end of file +--- +*/ [F(%g{@ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11968.d b/gcc/testsuite/gdc.test/fail_compilation/ice11968.d index ce0d9fc..651f162 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice11968.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice11968.d @@ -1 +1,9 @@ +/* +TEST_OUTPUT: +---- +fail_compilation/ice11968.d(9): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +fail_compilation/ice11968.d(9): Error: cannot modify string literal `"fail_compilation$?:windows=\\|/$ice11968.d"` +---- +*/ + void main() { delete __FILE__ ; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11974.d b/gcc/testsuite/gdc.test/fail_compilation/ice11974.d index d9f2f30..3bf5a70 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice11974.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice11974.d @@ -1 +1,7 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice11974.d(7): Error: cannot modify constant `0` +--- +*/ void main() { 0 = __LINE__ ^^ [ 0 ] ; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11982.d b/gcc/testsuite/gdc.test/fail_compilation/ice11982.d index 251dada..ff5fae4 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice11982.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice11982.d @@ -1 +1,16 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice11982.d(16): Error: basic type expected, not `scope` +fail_compilation/ice11982.d(16): Error: found `scope` when expecting `;` following statement +fail_compilation/ice11982.d(16): Error: basic type expected, not `}` +fail_compilation/ice11982.d(16): Error: missing `{ ... }` for function literal +fail_compilation/ice11982.d(16): Error: C style cast illegal, use `cast(funk)function _error_() +{ +} +` +fail_compilation/ice11982.d(16): Error: found `}` when expecting `;` following statement +fail_compilation/ice11982.d(17): Error: found `End of File` when expecting `}` following compound statement +--- +*/ void main() { new scope ( funk ) function } diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12497.d b/gcc/testsuite/gdc.test/fail_compilation/ice12497.d deleted file mode 100644 index ab95e81..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/ice12497.d +++ /dev/null @@ -1,18 +0,0 @@ -/* -TEST_OUTPUT: ---- -fail_compilation/ice12497.d(15): Error: string expected for argument to mixin, not (foo()) of type void -fail_compilation/ice12497.d(17): Error: string expected for argument to mixin, not (foo()) of type void ---- -*/ - -void foo() {} - -void main() -{ - struct S - { - mixin(foo()); // MixinDeclaration - } - mixin(foo()); // MixinStatement -} diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12501.d b/gcc/testsuite/gdc.test/fail_compilation/ice12501.d index f57980d..2c45c8a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice12501.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice12501.d @@ -1,9 +1,11 @@ /* TEST_OUTPUT: --- -fail_compilation/ice12501.d(29): Error: function ice12501.foo (int value) is not callable using argument types (int, int) -fail_compilation/ice12501.d(29): Error: function ice12501.foo (int value) is not callable using argument types (int, int) -fail_compilation/ice12501.d(43): Error: template instance ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[]) error instantiating +fail_compilation/ice12501.d(31): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` +fail_compilation/ice12501.d(31): expected 1 argument(s), not 2 +fail_compilation/ice12501.d(31): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` +fail_compilation/ice12501.d(31): expected 1 argument(s), not 2 +fail_compilation/ice12501.d(45): Error: template instance `ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[])` error instantiating --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12673.d b/gcc/testsuite/gdc.test/fail_compilation/ice12673.d index 57f0ec0..fb49e8e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice12673.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice12673.d @@ -1,3 +1,13 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice12673.d(13): Error: static assert: `__traits(compiles, () pure nothrow @nogc @safe +{ +__error__ +} +)` is false +--- +*/ void main() { static assert(__traits(compiles, { abcd(); })); diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13644.d b/gcc/testsuite/gdc.test/fail_compilation/ice13644.d index 87e56e4..aa44709 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice13644.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice13644.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice13644.d(22): Error: foreach: key cannot be of non-integral type `string` +--- +*/ struct Tuple(T...) { diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14907.d b/gcc/testsuite/gdc.test/fail_compilation/ice14907.d new file mode 100644 index 0000000..6d9edf0 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/ice14907.d @@ -0,0 +1,22 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice14907.d(14): Error: struct ice14907.S(int v = S) recursive template expansion +fail_compilation/ice14907.d(19): while looking for match for `S!()` +fail_compilation/ice14907.d(15): Error: template ice14907.f(int v = f)() recursive template expansion +fail_compilation/ice14907.d(20): while looking for match for `f!()` +fail_compilation/ice14907.d(15): Error: template ice14907.f(int v = f)() recursive template expansion +fail_compilation/ice14907.d(21): Error: template `ice14907.f` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/ice14907.d(15): `ice14907.f(int v = f)()` +--- +*/ + +struct S(int v = S) {} +void f(int v = f)() {} + +void main() +{ + S!() s; // OK <- ICE + f!()(); // OK <- ICE + f(); // OK <- ICE +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14923.d b/gcc/testsuite/gdc.test/fail_compilation/ice14923.d index 86e3b2a..e3b677e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice14923.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice14923.d @@ -1,8 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/ice14923.d(21): Error: function ice14923.parse (C a) is not callable using argument types (A) -fail_compilation/ice14923.d(21): instantiated from here: bar!((b) => parse(b)) +fail_compilation/ice14923.d(22): Error: function `ice14923.parse(C a)` is not callable using argument types `(A)` +fail_compilation/ice14923.d(22): cannot pass argument `b` of type `ice14923.A` to parameter `C a` +fail_compilation/ice14923.d(22): instantiated from here: `bar!((b) => parse(b))` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice15855.d b/gcc/testsuite/gdc.test/fail_compilation/ice15855.d index 407288b..e800838 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice15855.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice15855.d @@ -1,3 +1,24 @@ // REQUIRED_ARGS: -o- +/* +TEST_OUTPUT: +--- +fail_compilation/ice15855.d(25): Error: found `End of File` when expecting `(` +fail_compilation/ice15855.d(25): Error: found `End of File` instead of statement +fail_compilation/ice15855.d(25): Error: expression expected, not `End of File` +fail_compilation/ice15855.d(25): Error: found `End of File` when expecting `;` following `for` condition +fail_compilation/ice15855.d(25): Error: expression expected, not `End of File` +fail_compilation/ice15855.d(25): Error: found `End of File` when expecting `)` +fail_compilation/ice15855.d(25): Error: found `End of File` instead of statement +fail_compilation/ice15855.d(25): Error: found `End of File` when expecting `}` following compound statement +fail_compilation/ice15855.d(25): Error: found `End of File` when expecting `]` +fail_compilation/ice15855.d(25): Error: no identifier for declarator `a[() +{ +for (; 0; 0) +{ +} +} +]` +--- +*/ a[{for diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice7782.d b/gcc/testsuite/gdc.test/fail_compilation/ice7782.d index 161995a..d42011a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice7782.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice7782.d @@ -1,3 +1,14 @@ +/* +EXTRA_FILES: imports/ice7782algorithm.d imports/ice7782range.d +TEST_OUTPUT: +---- +fail_compilation/ice7782.d(13): Error: module `ice7782math` is in file 'imports/ice7782range/imports/ice7782math.d' which cannot be read +import path[0] = fail_compilation +import path[1] = $p:druntime/import$ +import path[2] = $p:phobos$ +---- +*/ + import imports.ice7782algorithm; import imports.ice7782range. imports.ice7782math; diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8255.d b/gcc/testsuite/gdc.test/fail_compilation/ice8255.d index d98e38a..0db3abc 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice8255.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice8255.d @@ -1,8 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/ice8255.d(10): Error: function ice8255.F!(G).F.f (ref G _param_0) is not callable using argument types (G) -fail_compilation/ice8255.d(10): while evaluating pragma(msg, F().f(G())) +fail_compilation/ice8255.d(11): Error: function `ice8255.F!(G).F.f(ref G _param_0)` is not callable using argument types `(G)` +fail_compilation/ice8255.d(11): cannot pass rvalue argument `G()` of type `G` to parameter `ref G _param_0` +fail_compilation/ice8255.d(11): while evaluating `pragma(msg, F().f(G()))` --- */ struct G {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8511.d b/gcc/testsuite/gdc.test/fail_compilation/ice8511.d deleted file mode 100644 index 873f896..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/ice8511.d +++ /dev/null @@ -1,13 +0,0 @@ -/* -TEST_OUTPUT: ---- -fail_compilation/ice8511.d(11): Error: enum ice8511.hypot.SQRTMAX is forward referenced looking for base type -fail_compilation/ice8511.d(12): Error: incompatible types for ((SQRTMAX) / (2)): cannot use '/' with types ---- -*/ - -real hypot() -{ - enum SQRTMAX; - SQRTMAX/2; -} diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8604.d b/gcc/testsuite/gdc.test/fail_compilation/ice8604.d index a734c2f..3c17998 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice8604.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice8604.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice8604.d(9): Error: undefined identifier `i` +--- +*/ struct StructFoo { static if(i) { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8630.d b/gcc/testsuite/gdc.test/fail_compilation/ice8630.d index ef733dc..a96ef34 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice8630.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice8630.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice8630.d(9): Error: undefined identifier `v` +fail_compilation/ice8630.d(10): Error: template instance `ice8630.foo!(int[])` error instantiating +--- +*/ auto map(alias func, R)(R r) { return r; } typeof(v) foo(R)(R v) { return map!(p=>p)(v); } void main() { foo([1]); } diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8742.d b/gcc/testsuite/gdc.test/fail_compilation/ice8742.d index 480a2d7..d814071 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice8742.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice8742.d @@ -1,4 +1,9 @@ -// PERMUTE_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/ice8742.d(15): Error: class `ice8742.main.__anonclass1` is nested within `main`, but super class `D` is nested within `C` +--- +*/ class C { class D { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9013.d b/gcc/testsuite/gdc.test/fail_compilation/ice9013.d index 116729f..47a451b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice9013.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice9013.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice9013.d(9): Error: undefined identifier `missing` +--- +*/ void main() { foreach (i; 0 .. missing) diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9254a.d b/gcc/testsuite/gdc.test/fail_compilation/ice9254a.d index 594b5ce..6b8f2f3 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice9254a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice9254a.d @@ -1,3 +1,14 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice9254a.d(15): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254a.d(15): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254a.d(15): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254a.d(15): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254a.d(15): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254a.d(15): Error: invalid `foreach` aggregate `false` +--- +*/ void main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9254b.d b/gcc/testsuite/gdc.test/fail_compilation/ice9254b.d index c5a9944..a430fbf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice9254b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice9254b.d @@ -1,3 +1,14 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice9254b.d(17): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254b.d(17): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254b.d(17): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254b.d(17): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254b.d(17): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254b.d(17): Error: invalid `foreach` aggregate `false` +--- +*/ class C { diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9254c.d b/gcc/testsuite/gdc.test/fail_compilation/ice9254c.d index d816bbf..b58cfe5 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice9254c.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice9254c.d @@ -1,3 +1,14 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice9254c.d(15): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254c.d(15): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254c.d(15): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254c.d(15): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254c.d(15): Error: Using the result of a comma expression is not allowed +fail_compilation/ice9254c.d(15): Error: invalid `foreach` aggregate `false` +--- +*/ void main() { diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9406.d b/gcc/testsuite/gdc.test/fail_compilation/ice9406.d index d8c0837..c1807a0 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice9406.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice9406.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/ice9406.d(21): Error: expression has no value +fail_compilation/ice9406.d(22): Error: `s1.mixin Mixin!() t1; +` has no effect --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9540.d b/gcc/testsuite/gdc.test/fail_compilation/ice9540.d index d6c9cda..f95cb97 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice9540.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice9540.d @@ -1,8 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/ice9540.d(34): Error: function ice9540.A.test.AddFront!(this, f).AddFront.dg (int _param_0) is not callable using argument types () -fail_compilation/ice9540.d(25): Error: template instance ice9540.A.test.AddFront!(this, f) error instantiating +fail_compilation/ice9540.d(35): Error: function `ice9540.A.test.AddFront!(this, f).AddFront.dg(int _param_0)` is not callable using argument types `()` +fail_compilation/ice9540.d(35): missing argument for parameter #1: `int _param_0` +fail_compilation/ice9540.d(26): Error: template instance `ice9540.A.test.AddFront!(this, f)` error instantiating --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/imphint.d b/gcc/testsuite/gdc.test/fail_compilation/imphint.d index 1e1387c..2b3abeb 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/imphint.d +++ b/gcc/testsuite/gdc.test/fail_compilation/imphint.d @@ -1,4 +1,5 @@ -/* PERMUTE_ARGS: +/* +TEST_OUTPUT: --- fail_compilation/imphint.d(14): Error: 'printf' is not defined, perhaps you need to import core.stdc.stdio; ? fail_compilation/imphint.d(15): Error: 'writeln' is not defined, perhaps you need to import std.stdio; ? diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d new file mode 100644 index 0000000..c104841 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d @@ -0,0 +1,3 @@ +module a17630; + +import b17630; diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d new file mode 100644 index 0000000..1a88493 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d @@ -0,0 +1,6 @@ +module a18219; + +struct AST +{ + import b18219; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d b/gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d new file mode 100644 index 0000000..5ad5f99 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d @@ -0,0 +1,3 @@ +module b17630; + +int Erase; diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d b/gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d new file mode 100644 index 0000000..6008c8a --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d @@ -0,0 +1,15 @@ +module b18219; + +class Foobar +{ + int a; + this(int a) + { + this.a = a; + } + static int smeth() + { + return 1; + } +} +void fun() {} diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice10598a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598a.d index b0e9c3b..b0e9c3b 100644 --- a/gcc/testsuite/gdc.test/compilable/imports/ice10598a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598a.d diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice10598b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598b.d index de50787..de50787 100644 --- a/gcc/testsuite/gdc.test/compilable/imports/ice10598b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598b.d diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d b/gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d new file mode 100644 index 0000000..d7edcc1 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d @@ -0,0 +1,4 @@ +module imports.imp15896; + +private int thebar=4; +package int packagebar=3; diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp15925.d b/gcc/testsuite/gdc.test/fail_compilation/imports/imp15925.d index c9d537a..c9d537a 100644 --- a/gcc/testsuite/gdc.test/compilable/imports/imp15925.d +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/imp15925.d diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/imp21353.d b/gcc/testsuite/gdc.test/fail_compilation/imports/imp21353.d new file mode 100644 index 0000000..e498b64 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/imp21353.d @@ -0,0 +1,7 @@ +module imports.imp21353; + +struct A { int x; } + +struct B { import imports.imp21353 : A; } + +private struct P { } diff --git a/gcc/testsuite/gdc.test/compilable/imports/test15117a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test15117a.d index 9daf6f1..9daf6f1 100644 --- a/gcc/testsuite/gdc.test/compilable/imports/test15117a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test15117a.d diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d new file mode 100644 index 0000000..4c85aad --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d @@ -0,0 +1,3 @@ +module imports.test21651b; + +alias T = int; diff --git a/gcc/testsuite/gdc.test/fail_compilation/isreturnonstack.d b/gcc/testsuite/gdc.test/fail_compilation/isreturnonstack.d new file mode 100644 index 0000000..1dde699 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/isreturnonstack.d @@ -0,0 +1,12 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/isreturnonstack.d(11): Error: argument to `__traits(isReturnOnStack, int)` is not a function +fail_compilation/isreturnonstack.d(12): Error: expected 1 arguments for `isReturnOnStack` but had 2 +--- +*/ + +int test() { return 0; } + +enum b = __traits(isReturnOnStack, int); +enum c = __traits(isReturnOnStack, test, int); diff --git a/gcc/testsuite/gdc.test/fail_compilation/issue16020.d b/gcc/testsuite/gdc.test/fail_compilation/issue16020.d new file mode 100644 index 0000000..75e3b9f --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/issue16020.d @@ -0,0 +1,13 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/issue16020.d(12): Error: user-defined attributes not allowed for `alias` declarations +fail_compilation/issue16020.d(13): Error: semicolon expected to close `alias` declaration +fail_compilation/issue16020.d(13): Error: declaration expected, not `(` +--- +*/ +module issue16020; + +struct UDA{} +alias Fun = @UDA void(); +alias FunTemplate = void(T)(T t); diff --git a/gcc/testsuite/gdc.test/fail_compilation/lookup.d b/gcc/testsuite/gdc.test/fail_compilation/lookup.d index 0bb5385..aedb44e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/lookup.d +++ b/gcc/testsuite/gdc.test/fail_compilation/lookup.d @@ -1,9 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/lookup.d(23): Error: no property 'X' for type 'lookup.B' +fail_compilation/lookup.d(23): Error: no property `X` for type `lookup.B`, did you mean `imports.imp2.X`? fail_compilation/lookup.d(23): while evaluating: `static assert((B).X == 0)` -fail_compilation/lookup.d(24): Error: no property 'Y' for type 'lookup.B' ++fail_compilation/lookup.d(24): Error: no property `Y` for type `lookup.B`, did you mean `imports.imp2.Y`? fail_compilation/lookup.d(24): while evaluating: `static assert((B).Y == 2)` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/mixintype2.d b/gcc/testsuite/gdc.test/fail_compilation/mixintype2.d new file mode 100644 index 0000000..b18627d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/mixintype2.d @@ -0,0 +1,16 @@ + +/* TEST_OUTPUT: +--- +fail_compilation/mixintype2.d(10): Error: alias `mixintype2.Foo.T` recursive alias declaration +fail_compilation/mixintype2.d(16): Error: `mixin(0)` does not give a valid type +--- +*/ + +struct Foo { + alias T = mixin("T2"); +} +alias T1 = mixin("Foo.T"); +alias T2 = mixin("T1"); +void func (T2 p) {} + +enum mixin(0) a = 0; diff --git a/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d b/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d index f419869..6a5a16d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d +++ b/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d @@ -1,6 +1,6 @@ /* REQUIRED_ARGS: -m64 -PERMUTE_ARGS: +TEST_OUTPUT: --- fail_compilation/staticarrayoverflow.d(24): Error: static array `S[1879048192]` size overflowed to 7516192768000 fail_compilation/staticarrayoverflow.d(24): Error: variable `staticarrayoverflow.y` size overflow diff --git a/gcc/testsuite/gdc.test/fail_compilation/test1.d b/gcc/testsuite/gdc.test/fail_compilation/test1.d index 9dae856..aeceb52 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test1.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test1.d @@ -1 +1,7 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test1.d(8): Error: no identifier for declarator `fail` +--- +*/ fail diff --git a/gcc/testsuite/gdc.test/fail_compilation/test11176.d b/gcc/testsuite/gdc.test/fail_compilation/test11176.d index 242119e..020d807 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test11176.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test11176.d @@ -1,5 +1,6 @@ /* REQUIRED_ARGS: -de +TEST_OUTPUT: --- fail_compilation/test11176.d(12): Deprecation: b.ptr cannot be used in @safe code, use &b[0] instead fail_compilation/test11176.d(16): Deprecation: b.ptr cannot be used in @safe code, use &b[0] instead diff --git a/gcc/testsuite/gdc.test/fail_compilation/test143.d b/gcc/testsuite/gdc.test/fail_compilation/test143.d index 94f614a..c95ecc1 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test143.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test143.d @@ -1,5 +1,13 @@ // REQUIRED_ARGS: -de -module test143; // Bugzilla 143 +// https://issues.dlang.org/show_bug.cgi?id=143 +// EXTRA_FILES: imports/test143.d +/* +TEST_OUTPUT: +--- +fail_compilation/test143.d(19): Error: undefined identifier `x` +--- +*/ +module test143; import imports.test143; diff --git a/gcc/testsuite/gdc.test/compilable/test15177.d b/gcc/testsuite/gdc.test/fail_compilation/test15117.d index 0bb2d04..e6ce3b5 100644 --- a/gcc/testsuite/gdc.test/compilable/test15177.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15117.d @@ -1,6 +1,13 @@ // REQUIRED_ARGS: -o- // PERMUTE_ARGS: -// EXTRA_SOURCES: imports/test15117a.d +// COMPILED_IMPORTS: imports/test15117a.d +/* +TEST_OUTPUT: +--- +fail_compilation/test15177.d-mixin-20(20): Error: `imports.test15117a.object` is not visible from module `test15177` +fail_compilation/test15177.d(29): Error: template instance `test15177.RunApiTest!()` error instantiating +--- +*/ import users = imports.test15117a; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15399.d b/gcc/testsuite/gdc.test/fail_compilation/test15399.d index 8aecfde..bad3ed2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15399.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15399.d @@ -1,4 +1,5 @@ /* https://issues.dlang.org/show_bug.cgi?id=15399 +TEST_OUTPUT: --- fail_compilation/test15399.d(31): Error: writing to misaligned pointer in field S1.ptr is not @safe fail_compilation/test15399.d(32): Error: writing to misaligned pointer in field S2.ptr is not @safe diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15785.d b/gcc/testsuite/gdc.test/fail_compilation/test15785.d index b35e510..474076f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15785.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15785.d @@ -2,12 +2,11 @@ /* TEST_OUTPUT: --- -fail_compilation/test15785.d(17): Deprecation: imports.test15785.Base.foo is not visible from module test15785 -fail_compilation/test15785.d(17): Error: class test15785.Derived member `foo` is not accessible -fail_compilation/test15785.d(18): Deprecation: imports.test15785.Base.bar is not visible from module test15785 -fail_compilation/test15785.d(18): Error: class test15785.Derived member `bar` is not accessible +fail_compilation/test15785.d(16): Error: no property `foo` for type `imports.test15785.Base`, did you mean `imports.test15785.Base.foo`? +fail_compilation/test15785.d(17): Error: undefined identifier `bar` --- */ + import imports.test15785; class Derived : Base diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15785b.d b/gcc/testsuite/gdc.test/fail_compilation/test15785b.d index 1613617..e09b4bf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15785b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15785b.d @@ -1,11 +1,11 @@ -// REQUIRED_ARGS: -de +// REQUIRED_ARGS: // PERMUTE_ARGS: /* TEST_OUTPUT: --- -fail_compilation/test15785b.d(15): Deprecation: imports.test15785.Base.T is not visible from module test15785b -fail_compilation/test15785b.d(16): Deprecation: imports.test15785.Base.T is not visible from module test15785b -fail_compilation/test15785b.d(17): Deprecation: imports.test15785.IBase2.T is not visible from module test15785b +fail_compilation/test15785b.d(15): Error: `imports.test15785.Base.T` is not visible from module `test15785b` +fail_compilation/test15785b.d(16): Error: `imports.test15785.Base.T` is not visible from module `test15785b` +fail_compilation/test15785b.d(17): Error: `imports.test15785.IBase2.T` is not visible from module `test15785b` --- */ import imports.test15785; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15897.d b/gcc/testsuite/gdc.test/fail_compilation/test15897.d index 19c65b4..aa22c10 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15897.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15897.d @@ -2,7 +2,7 @@ /* TEST_OUTPUT: --- -fail_compilation/test15897.d(18): Deprecation: test15897.Animal.create is not visible from class Cat +fail_compilation/test15897.d(18): Error: no property `create` for type `imports.test15897.Cat` --- */ module test15897; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15925.d b/gcc/testsuite/gdc.test/fail_compilation/test15925.d new file mode 100644 index 0000000..9359859 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test15925.d @@ -0,0 +1,19 @@ +/* REQUIRED_ARGS: +PERMUTE_ARGS: +TEST_OUTPUT: +--- +fail_compilation/test15925.d(18): Error: undefined identifier `X` +fail_compilation/test15925.d(18): while evaluating: `static assert(X == 1)` +--- +*/ + +mixin template Import() +{ + import imports.imp15925; +} + +class Foo +{ + mixin Import!(); + static assert(X == 1); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16188.d b/gcc/testsuite/gdc.test/fail_compilation/test16188.d index ffdb41a..38219e9 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test16188.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test16188.d @@ -1,4 +1,9 @@ -/* PERMUTE_ARGS: +TEST_OUTPUT: +--- +fail_compilation/test16188.d(1): Error: no identifier for declarator `TEST_OUTPUT` +fail_compilation/test16188.d(1): Error: declaration expected, not `:` +fail_compilation/test16188.d(18): Error: unrecognized declaration +--- */ // https://issues.dlang.org/show_bug.cgi?id=16188 diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16228.d b/gcc/testsuite/gdc.test/fail_compilation/test16228.d index 6aa79a2..63951e6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test16228.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test16228.d @@ -1,13 +1,13 @@ /* REQUIRED_ARGS: -dip25 TEST_OUTPUT: --- -fail_compilation/test16228.d(22): Error: function type 'return int()' has 'return' but does not return any indirections -fail_compilation/test16228.d(23): Error: function test16228.S.foo static member has no 'this' to which 'return' can apply +fail_compilation/test16228.d(23): Error: function `test16228.S.bar` `static` member has no `this` to which `return` can apply --- */ + // https://issues.dlang.org/show_bug.cgi?id=16228 int* wrap ( return ref int input ) @@ -20,5 +20,16 @@ struct S int x; int foo() return { return 3; } - static ref int foo() return { return x; } + static ref int bar() return { return x; } +} + + +// https://issues.dlang.org/show_bug.cgi?id=18963 + +T Identity(T)(return T t) { return t; } + +void bar(int i, void* p) +{ + Identity(p); + Identity(i); } diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17096.d b/gcc/testsuite/gdc.test/fail_compilation/test17096.d new file mode 100644 index 0000000..e421419 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test17096.d @@ -0,0 +1,50 @@ +/* TEST_OUTPUT: +--- +fail_compilation/test17096.d(28): Error: expected 1 arguments for `isPOD` but had 2 +fail_compilation/test17096.d(29): Error: expected 1 arguments for `isNested` but had 2 +fail_compilation/test17096.d(30): Error: expected 1 arguments for `isVirtualFunction` but had 2 +fail_compilation/test17096.d(31): Error: expected 1 arguments for `isVirtualMethod` but had 2 +fail_compilation/test17096.d(32): Error: expected 1 arguments for `isAbstractFunction` but had 2 +fail_compilation/test17096.d(33): Error: expected 1 arguments for `isFinalFunction` but had 2 +fail_compilation/test17096.d(34): Error: expected 1 arguments for `isOverrideFunction` but had 2 +fail_compilation/test17096.d(35): Error: expected 1 arguments for `isStaticFunction` but had 2 +fail_compilation/test17096.d(36): Error: expected 1 arguments for `isRef` but had 2 +fail_compilation/test17096.d(37): Error: expected 1 arguments for `isOut` but had 2 +fail_compilation/test17096.d(38): Error: expected 1 arguments for `isLazy` but had 2 +fail_compilation/test17096.d(39): Error: expected 1 arguments for `identifier` but had 2 +fail_compilation/test17096.d(40): Error: expected 1 arguments for `getProtection` but had 2 +fail_compilation/test17096.d(41): Error: expected 1 arguments for `parent` but had 2 +fail_compilation/test17096.d(42): Error: expected 1 arguments for `classInstanceSize` but had 2 +fail_compilation/test17096.d(43): Error: expected 1 arguments for `allMembers` but had 2 +fail_compilation/test17096.d(44): Error: expected 1 arguments for `derivedMembers` but had 2 +fail_compilation/test17096.d(45): Error: expected 1 arguments for `getAliasThis` but had 2 +fail_compilation/test17096.d(46): Error: expected 1 arguments for `getAttributes` but had 2 +fail_compilation/test17096.d(47): Error: expected 1 arguments for `getFunctionAttributes` but had 2 +fail_compilation/test17096.d(48): Error: expected 1 arguments for `getUnitTests` but had 2 +fail_compilation/test17096.d(49): Error: expected 1 arguments for `getVirtualIndex` but had 2 +fail_compilation/test17096.d(50): Error: a single type expected for trait pointerBitmap +--- +*/ +enum b03 = __traits(isPOD, 1, 2); +enum b04 = __traits(isNested, 1, 2); +enum b05 = __traits(isVirtualFunction, 1, 2); +enum b06 = __traits(isVirtualMethod, 1, 2); +enum b07 = __traits(isAbstractFunction, 1, 2); +enum b08 = __traits(isFinalFunction, 1, 2); +enum b09 = __traits(isOverrideFunction, 1, 2); +enum b10 = __traits(isStaticFunction, 1, 2); +enum b11 = __traits(isRef, 1, 2); +enum b12 = __traits(isOut, 1, 2); +enum b13 = __traits(isLazy, 1, 2); +enum b14 = __traits(identifier, 1, 2); +enum b15 = __traits(getProtection, 1, 2); +enum b16 = __traits(parent, 1, 2); +enum b17 = __traits(classInstanceSize, 1, 2); +enum b18 = __traits(allMembers, 1, 2); +enum b19 = __traits(derivedMembers, 1, 2); +enum b20 = __traits(getAliasThis, 1, 2); +enum b21 = __traits(getAttributes, 1, 2); +enum b22 = __traits(getFunctionAttributes, 1, 2); +enum b23 = __traits(getUnitTests, 1, 2); +enum b24 = __traits(getVirtualIndex, 1, 2); +enum b25 = __traits(getPointerBitmap, 1, 2); diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17908a.d b/gcc/testsuite/gdc.test/fail_compilation/test17908a.d new file mode 100644 index 0000000..9072397 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test17908a.d @@ -0,0 +1,15 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test17908a.d(10): Error: function `test17908a.foo` cannot be used because it is annotated with `@disable` +--- +*/ + +@disable void foo(); +@disable void foo(int) {} +alias g = foo; + +void main() +{ + g(10); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17908b.d b/gcc/testsuite/gdc.test/fail_compilation/test17908b.d new file mode 100644 index 0000000..e2c4d84 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test17908b.d @@ -0,0 +1,14 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test17908b.d(13): Error: function `test17908b.foobar` cannot be used because it is annotated with `@disable` +--- +*/ +void foobar() {} +@disable void foobar(int) {} +alias i = foobar; + +void main() +{ + i(10); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20919.d b/gcc/testsuite/gdc.test/fail_compilation/test20919.d new file mode 100644 index 0000000..2f1bad1 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test20919.d @@ -0,0 +1,13 @@ +/* TEST_OUTPUT: +--- +fail_compilation/test20919.d(12): Error: `__traits(getAttributes, int a)` does not give a valid type +--- +*/ +// https://issues.dlang.org/show_bug.cgi?id=20919 + +void foo(int a) {} + +static if (is(typeof(foo) params == __parameters)) +{ + __traits(getAttributes, params) a; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21353.d b/gcc/testsuite/gdc.test/fail_compilation/test21353.d new file mode 100644 index 0000000..0f22fe7 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test21353.d @@ -0,0 +1,26 @@ +/* +EXTRA_FILES: imports/imp21353.d +TEST_OUTPUT: +--- +fail_compilation/test21353.d(19): Error: no property `A` for type `imports.imp21353.B` +fail_compilation/test21353.d(20): Error: no property `A` for type `imports.imp21353.B` +fail_compilation/test21353.d(21): Error: no property `A` for type `imports.imp21353.B` +fail_compilation/test21353.d(23): Error: undefined identifier `P` in module `imports.imp21353` +fail_compilation/test21353.d(24): Error: undefined identifier `P` in module `imports.imp21353` +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=21353 + +import imports.imp21353; + +void main() +{ + B.A; + with (B) { A(0); } + with (B()) { A(0); } // fixed + + imports.imp21353.P(); + with (imports.imp21353) { P(); } // fixed +} + diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21651.d b/gcc/testsuite/gdc.test/fail_compilation/test21651.d new file mode 100644 index 0000000..a4d959f --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test21651.d @@ -0,0 +1,11 @@ +// REQUIRED_ARGS: -de +// EXTRA_SOURCES: imports/test21651b.d +/* TEST_OUTPUT: +--- +fail_compilation/test21651.d(11): Deprecation: module imports.test21651b is not accessible here, perhaps add 'static import imports.test21651b;' +--- +*/ + +module imports.test21651; + +imports.test21651b.T a; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21927.d b/gcc/testsuite/gdc.test/fail_compilation/test21927.d new file mode 100644 index 0000000..fa23285 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test21927.d @@ -0,0 +1,20 @@ +// https://issues.dlang.org/show_bug.cgi?id=21927 +/* +TEST_OUTPUT: +--- +fail_compilation/test21927.d(17): Error: invalid `foreach` aggregate `this.T2(Args2...)` +fail_compilation/test21927.d(18): Error: invalid `foreach` aggregate `this.T2!()` +--- +*/ + +struct S +{ + template T2(Args2...) {} + + void fun() + { + // original test case + static foreach (p; this.T2) {} // ICE + static foreach (p; this.T2!()) {} // ICE + } +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21939.d b/gcc/testsuite/gdc.test/fail_compilation/test21939.d new file mode 100644 index 0000000..cb755ef --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test21939.d @@ -0,0 +1,9 @@ +// https://issues.dlang.org/show_bug.cgi?id=21939 +/* +TEST_OUTPUT: +--- +fail_compilation/test21939.d(9): Error: invalid `foreach` aggregate `Object`, define `opApply()`, range primitives, or use `.tupleof` +--- +*/ + +static foreach (a; Object) {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test314.d b/gcc/testsuite/gdc.test/fail_compilation/test314.d index 3dea03f..eb3f07d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test314.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test314.d @@ -1,11 +1,11 @@ /* -REQUIRED_ARGS: -de +REQUIRED_ARGS: TEST_OUTPUT: --- -fail_compilation/test314.d(19): Deprecation: imports.a314.renamed is not visible from module test314 -fail_compilation/test314.d(20): Deprecation: imports.a314.bug is not visible from module test314 -fail_compilation/test314.d(22): Deprecation: imports.b314.renamedpkg is not visible from module test314 -fail_compilation/test314.d(23): Deprecation: imports.b314.bugpkg is not visible from module test314 +fail_compilation/test314.d(19): Error: undefined identifier `renamed` +fail_compilation/test314.d(20): Error: undefined identifier `bug` +fail_compilation/test314.d(22): Error: undefined identifier `renamedpkg` +fail_compilation/test314.d(23): Error: undefined identifier `bugpkg` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test5412a.d b/gcc/testsuite/gdc.test/fail_compilation/test5412a.d index 412cb21..3577834 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test5412a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test5412a.d @@ -1,3 +1,10 @@ +/* +EXTRA_FILES: imports/test5412a.d imports/test5412b.d +TEST_OUTPUT: +--- +fail_compilation/test5412a.d(11): Error: import `test5412a.A` conflicts with import `test5412a.A` at fail_compilation/test5412a.d(10) +--- +*/ module test5412a; import A = imports.test5412a; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test5412b.d b/gcc/testsuite/gdc.test/fail_compilation/test5412b.d index 846fdd3..8f06b52 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test5412b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test5412b.d @@ -1,3 +1,10 @@ +/* +EXTRA_FILES: imports/test5412a.d imports/test5412b.d +TEST_OUTPUT: +--- +fail_compilation/test5412b.d(11): Error: static import `test5412b.A` conflicts with import `test5412b.A` at fail_compilation/test5412b.d(10) +--- +*/ module test5412b; import A = imports.test5412a; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test5412c.d b/gcc/testsuite/gdc.test/fail_compilation/test5412c.d index 88290f6..b3073ee 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test5412c.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test5412c.d @@ -1,3 +1,10 @@ +/* +EXTRA_FILES: test5412c2.di imports/test5412a.d +TEST_OUTPUT: +--- +fail_compilation/test5412c.d(11): Error: import `test5412c.test5412c2` conflicts with import `test5412c.test5412c2` at fail_compilation/test5412c.d(10) +--- +*/ module test5412c; import test5412c2 = imports.test5412a; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test5412c2.di b/gcc/testsuite/gdc.test/fail_compilation/test5412c2.di new file mode 100644 index 0000000..0023c5f --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test5412c2.di @@ -0,0 +1 @@ +module test5412c2; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test8509.d b/gcc/testsuite/gdc.test/fail_compilation/test8509.d index 121ae9e..b39c00f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test8509.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test8509.d @@ -1,3 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test8509.d(13): Error: cannot implicitly convert expression `"hello world"` of type `string` to `E` +fail_compilation/test8509.d(14): Error: cannot implicitly convert expression `"hello world"` of type `string` to `E` +--- +*/ module test8509; enum E : string { a = "hello", b = "world" } diff --git a/gcc/testsuite/gdc.test/fail_compilation/test8751.d b/gcc/testsuite/gdc.test/fail_compilation/test8751.d index f739a5a..d7057b8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test8751.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test8751.d @@ -1,3 +1,9 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test8751.d(7): Error: undefined identifier `Bar` +--- +*/ Bar foo3(ref const int x) pure { return y => x > y; // error } diff --git a/gcc/testsuite/gdc.test/fail_compilation/test9701.d b/gcc/testsuite/gdc.test/fail_compilation/test9701.d new file mode 100644 index 0000000..384c514 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test9701.d @@ -0,0 +1,63 @@ +/* +TEST_OUTPUT +--- +fail_compilation/test9701.d(38): Error: `@safe` is not a valid attribute for enum members +fail_compilation/test9701.d(39): Error: `@system` is not a valid attribute for enum members +fail_compilation/test9701.d(40): Error: `@trusted` is not a valid attribute for enum members +fail_compilation/test9701.d(41): Error: `@nogc` is not a valid attribute for enum members +fail_compilation/test9701.d(42): Error: `pure` is not a valid attribute for enum members +fail_compilation/test9701.d(43): Error: `shared` is not a valid attribute for enum members +fail_compilation/test9701.d(44): Error: `inout` is not a valid attribute for enum members +fail_compilation/test9701.d(45): Error: `immutable` is not a valid attribute for enum members +fail_compilation/test9701.d(46): Error: `const` is not a valid attribute for enum members +fail_compilation/test9701.d(47): Error: `synchronized` is not a valid attribute for enum members +fail_compilation/test9701.d(48): Error: `scope` is not a valid attribute for enum members +fail_compilation/test9701.d(49): Error: `auto` is not a valid attribute for enum members +fail_compilation/test9701.d(50): Error: `ref` is not a valid attribute for enum members +fail_compilation/test9701.d(51): Error: `__gshared` is not a valid attribute for enum members +fail_compilation/test9701.d(52): Error: `final` is not a valid attribute for enum members +fail_compilation/test9701.d(53): Error: `extern` is not a valid attribute for enum members +fail_compilation/test9701.d(54): Error: `export` is not a valid attribute for enum members +fail_compilation/test9701.d(55): Error: `nothrow` is not a valid attribute for enum members +fail_compilation/test9701.d(56): Error: `public` is not a valid attribute for enum members +fail_compilation/test9701.d(57): Error: `private` is not a valid attribute for enum members +fail_compilation/test9701.d(58): Error: `package` is not a valid attribute for enum members +fail_compilation/test9701.d(59): Error: `static` is not a valid attribute for enum members +fail_compilation/test9701.d(60): Error: `static` is not a valid attribute for enum members +fail_compilation/test9701.d(61): Error: `static` is not a valid attribute for enum members +fail_compilation/test9701.d(62): Error: `static` is not a valid attribute for enum members +--- +*/ + +// This test exists to verify that parsing of enum member attributes rejects invalid attributes + +// https://issues.dlang.org/show_bug.cgi?id=9701 + +enum Enum +{ + @safe safe, + @system system, + @trusted trusted, + @nogc nogc, + pure pure_, + shared shared_, + inout inout_, + immutable immutable_, + const const_, + synchronized synchronized_, + scope scope_, + auto auto_, + ref ref_, + __gshared __gshared_, + final final_, + extern extern_, + export export_, + nothrow nothrow_, + public public_, + private private_, + package package_, + static static1, + @("a") static static2, + static @("a") static3, + @("a") static @("b") static3, +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test9701b.d b/gcc/testsuite/gdc.test/fail_compilation/test9701b.d new file mode 100644 index 0000000..16c2541 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test9701b.d @@ -0,0 +1,22 @@ +/* +REQUIRED_ARGS: -de +TEST_OUTPUT +--- +fail_compilation/test9701b.d(20): Deprecation: enum member `test9701b.Enum.e0` is deprecated +fail_compilation/test9701b.d(21): Deprecation: enum member `test9701b.Enum.e1` is deprecated - message +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=9701 + +enum Enum +{ + deprecated e0, + deprecated("message") e1, +} + +void main() +{ + auto value = Enum.e0; + auto value2 = Enum.e1; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/trait_loc_err.d b/gcc/testsuite/gdc.test/fail_compilation/trait_loc_err.d new file mode 100644 index 0000000..8d5d480 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/trait_loc_err.d @@ -0,0 +1,15 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/trait_loc_err.d(13): Error: can only get the location of a symbol, not `trait_loc_err` +fail_compilation/trait_loc_err.d(14): Error: can only get the location of a symbol, not `std` +--- +*/ +module trait_loc_err; +import std.stdio; + +void main() +{ + __traits(getLocation, __traits(parent, main)); + __traits(getLocation, __traits(parent, std.stdio)); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/trait_loc_ov_err.d b/gcc/testsuite/gdc.test/fail_compilation/trait_loc_ov_err.d new file mode 100644 index 0000000..313e57d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/trait_loc_ov_err.d @@ -0,0 +1,40 @@ +module trait_loc_ov_err; +/* +TEST_OUTPUT: +--- +fail_compilation/trait_loc_ov_err.d(24): Error: cannot get location of an overload set, use `__traits(getOverloads, ..., "ov1")[N]` to get the Nth overload +fail_compilation/trait_loc_ov_err.d(25): Error: cannot get location of an overload set, use `__traits(getOverloads, ..., "ov2")[N]` to get the Nth overload +--- +*/ + +void ov1(){} +void ov1(int){} + +void ov21(){} +void ov22(int){} +alias ov2 = ov21; +alias ov2 = ov22; + +template OvT(T, U){} +template OvT(T){} + +auto func(T)(T t) {} +auto func(T,U)(T t,U u) {} + +enum e1 = __traits(getLocation, ov1); +enum e2 = __traits(getLocation, ov2); + +enum e3 = __traits(getLocation, OvT); +enum e4 = __traits(getLocation, func); + +enum e5 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "ov1")[0]); +enum e6 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "ov1")[1]); + +enum e7 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "ov2")[0]); +enum e8 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "ov2")[1]); + +enum e9 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "OvT", true)[1]); +enum e10 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "OvT", true)[0]); + +enum e11 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "func", true)[0]); +enum e12 = __traits(getLocation, __traits(getOverloads, trait_loc_ov_err, "func", true)[1]); diff --git a/gcc/testsuite/gdc.test/fail_compilation/traits.d b/gcc/testsuite/gdc.test/fail_compilation/traits.d new file mode 100644 index 0000000..bee29ed --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/traits.d @@ -0,0 +1,27 @@ +/************************************************************/ + +/* +TEST_OUTPUT: +--- +fail_compilation/traits.d(100): Error: `getTargetInfo` key `"not_a_target_info"` not supported by this implementation +fail_compilation/traits.d(101): Error: string expected as argument of __traits `getTargetInfo` instead of `100` +fail_compilation/traits.d(102): Error: expected 1 arguments for `getTargetInfo` but had 2 +fail_compilation/traits.d(103): Error: expected 1 arguments for `getTargetInfo` but had 0 +fail_compilation/traits.d(200): Error: undefined identifier `imports.nonexistent` +fail_compilation/traits.d(201): Error: undefined identifier `imports.nonexistent` +fail_compilation/traits.d(202): Error: expected 1 arguments for `isPackage` but had 0 +fail_compilation/traits.d(203): Error: expected 1 arguments for `isModule` but had 0 +--- +*/ + +#line 100 +enum A1 = __traits(getTargetInfo, "not_a_target_info"); +enum B1 = __traits(getTargetInfo, 100); +enum C1 = __traits(getTargetInfo, "cppRuntimeLibrary", "bits"); +enum D1 = __traits(getTargetInfo); + +#line 200 +enum A2 = __traits(isPackage, imports.nonexistent); +enum B2 = __traits(isModule, imports.nonexistent); +enum C2 = __traits(isPackage); +enum D2 = __traits(isModule); diff --git a/gcc/testsuite/gdc.test/fail_compilation/traits_child.d b/gcc/testsuite/gdc.test/fail_compilation/traits_child.d new file mode 100644 index 0000000..7a0b75e --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/traits_child.d @@ -0,0 +1,17 @@ +/************************************************************/ + +/* +TEST_OUTPUT: +--- +fail_compilation/traits_child.d(100): Error: expected 2 arguments for `child` but had 1 +fail_compilation/traits_child.d(101): Error: symbol or expression expected as first argument of __traits +child` instead of `long` +fail_compilation/traits_child.d(102): Error: symbol expected as second argument of __traits `child` inste +d of `3` +--- +*/ + +#line 100 +enum a = __traits(child, long); +enum b = __traits(child, long, 3); +enum c = __traits(child, "hi", 3); diff --git a/gcc/testsuite/gdc.test/fail_compilation/udaparams.d b/gcc/testsuite/gdc.test/fail_compilation/udaparams.d new file mode 100644 index 0000000..ec760bd --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/udaparams.d @@ -0,0 +1,57 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/udaparams.d(31): Error: variadic parameter cannot have user-defined attributes +fail_compilation/udaparams.d(32): Error: variadic parameter cannot have user-defined attributes +fail_compilation/udaparams.d(34): Error: user-defined attributes cannot appear as postfixes +fail_compilation/udaparams.d(35): Error: user-defined attributes cannot appear as postfixes +fail_compilation/udaparams.d(36): Error: user-defined attributes cannot appear as postfixes +fail_compilation/udaparams.d(38): Error: `@safe` attribute for function parameter is not supported +fail_compilation/udaparams.d(39): Error: `@safe` attribute for function parameter is not supported +fail_compilation/udaparams.d(40): Error: `@safe` attribute for function parameter is not supported +fail_compilation/udaparams.d(43): Error: `@system` attribute for function parameter is not supported +fail_compilation/udaparams.d(44): Error: `@trusted` attribute for function parameter is not supported +fail_compilation/udaparams.d(45): Error: `@nogc` attribute for function parameter is not supported +fail_compilation/udaparams.d(51): Error: Cannot put a storage-class in an alias declaration. +fail_compilation/udaparams.d(52): Error: Cannot put a storage-class in an alias declaration. +fail_compilation/udaparams.d(53): Error: semicolon expected to close `alias` declaration +fail_compilation/udaparams.d(53): Error: declaration expected, not `=>` +fail_compilation/udaparams.d(54): Error: semicolon expected to close `alias` declaration +fail_compilation/udaparams.d(54): Error: declaration expected, not `=>` +fail_compilation/udaparams.d(57): Error: basic type expected, not `@` +fail_compilation/udaparams.d(57): Error: identifier expected for template value parameter +fail_compilation/udaparams.d(57): Error: found `@` when expecting `)` +fail_compilation/udaparams.d(57): Error: basic type expected, not `3` +fail_compilation/udaparams.d(57): Error: found `3` when expecting `)` +fail_compilation/udaparams.d(57): Error: semicolon expected following function declaration +fail_compilation/udaparams.d(57): Error: declaration expected, not `)` +--- +*/ + +void vararg1(int a, @(10) ...); +extern(C) void vararg2(int a, @(10) ...); + +void rhsuda(int a @(10)); +void rhsuda2(int @(10)); +void rhsuda3(int[] arr @(10) ...); + +void wrongAttr1(@safe int); +void wrongAttr2(@safe void function()); +void wrongAttr3(@safe void delegate()); + + +void test16(A)(A a @system); +void test16(A)(A a @trusted); +void test16(A)(A a @nogc); + +// lambdas without parentheses +alias test19a = @safe b => 1 + 2; +alias test19b = @system b => 1 + 2; +alias test19c = @nogc b => 1 + 2; +alias test19d = @(2) @system b => 1 + 2; +alias test19e = @safe @(2) b => 1 + 2; +alias test19f = extern(C++) b => 1 + 2; +alias test19g = align(2) b => 1 + 2; + +// UDAs on Template parameter aren't supported +void test21(@(3) T)(T t) {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/warn12809.d b/gcc/testsuite/gdc.test/fail_compilation/warn12809.d index 100f0fb..06c998d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/warn12809.d +++ b/gcc/testsuite/gdc.test/fail_compilation/warn12809.d @@ -32,3 +32,44 @@ void test_unrachable3() int x = 1; // unreachable } + +/********************************************/ + +/* +TEST_OUTPUT: +--- +fail_compilation/warn12809.d(108): Warning: statement is not reachable +fail_compilation/warn12809.d(115): Warning: statement is not reachable +fail_compilation/warn12809.d(122): Warning: statement is not reachable +Error: warnings are treated as errors + Use -wi if you wish to treat warnings only as informational. +--- +*/ + +#line 100 + +alias noreturn = typeof(*null); + +noreturn foo(); + +void test1(ref int i) +{ + foo(); + i = 3; +} + +void test2() +{ + try foo(); + finally { } + int x = 1; +} + +void test3() +{ + try { } + finally foo(); + int x = 1; +} + + diff --git a/gcc/testsuite/gdc.test/runnable/aliasthis.d b/gcc/testsuite/gdc.test/runnable/aliasthis.d index 8cd0051..ee8e6a1 100644 --- a/gcc/testsuite/gdc.test/runnable/aliasthis.d +++ b/gcc/testsuite/gdc.test/runnable/aliasthis.d @@ -1,3 +1,29 @@ +/* +TEST_OUTPUT: +--- +false +[] = int +[] = string +[0] = int +[1] = string +[] = string +[] = int +[1] = string +[0] = int +--- + +RUN_OUTPUT: +--- +1 1.1 +ctor +cpctor +dtor +cpctor +dtor +dtor +Success +--- +*/ extern (C) int printf(const(char*) fmt, ...); import core.vararg; @@ -551,7 +577,7 @@ void test2781() } eval = 0; - foreach (i, e; tup(tup((eval++, 10), 3.14), tup("str", [1,2]))) + foreach (i, e; tup(tup((){eval++; return 10;}(), 3.14), tup("str", [1,2]))) { static if (i == 0) assert(e == tup(10, 3.14)); static if (i == 1) assert(e == tup("str", [1,2])); @@ -559,7 +585,7 @@ void test2781() assert(eval == 1); eval = 0; - foreach (i, e; tup((eval++,10), tup(3.14, tup("str", tup([1,2]))))) + foreach (i, e; tup((){eval++; return 10;}(), tup(3.14, tup("str", tup([1,2]))))) { static if (i == 0) assert(e == 10); static if (i == 1) assert(e == tup(3.14, tup("str", tup([1,2])))); @@ -836,7 +862,7 @@ void test6369c() void test6369d() { int eval = 0; - Seq!(int, string) t = tup((++eval, 10), "str"); + Seq!(int, string) t = tup((){++eval; return 10;}(), "str"); assert(eval == 1); assert(t[0] == 10); assert(t[1] == "str"); diff --git a/gcc/testsuite/gdc.test/runnable/constfold.d b/gcc/testsuite/gdc.test/runnable/constfold.d index 42406ea..1d259f6 100644 --- a/gcc/testsuite/gdc.test/runnable/constfold.d +++ b/gcc/testsuite/gdc.test/runnable/constfold.d @@ -302,7 +302,6 @@ static assert(is(typeof( (){ C4 g = 7; C4 h = g;}))); alias uint DWORD; MY_API_FUNCTION lpStartAddress; extern (Windows) alias DWORD function(void*) MY_API_FUNCTION; -pragma(msg, MY_API_FUNCTION.stringof); static assert(MY_API_FUNCTION.stringof == "extern (Windows) uint function(void*)"); /************************************/ @@ -565,7 +564,8 @@ void test13977() Object.init && check(); assert(x == 0); - (check(2), false) && check(); + check(2); + false && check(); assert(x == 2); x = 0; } @@ -594,7 +594,8 @@ void test13978() Object.init || check(); assert(x == 1); x = 0; - (check(2), true) || check(); + check(2); + true || check(); assert(x == 2); x = 0; } diff --git a/gcc/testsuite/gdc.test/runnable/ctorpowtests.d b/gcc/testsuite/gdc.test/runnable/ctorpowtests.d index 1b81a9e..89f846a 100644 --- a/gcc/testsuite/gdc.test/runnable/ctorpowtests.d +++ b/gcc/testsuite/gdc.test/runnable/ctorpowtests.d @@ -141,7 +141,8 @@ static assert(bazra(14)==64); void moreCommaTests() { - auto k = (containsAsm(), containsAsm()); + (containsAsm(), containsAsm()); + auto k = containsAsm(); for (int i=0; i< k^^2; i+=StructWithCtor(1).n) {} } diff --git a/gcc/testsuite/gdc.test/runnable/declaration.d b/gcc/testsuite/gdc.test/runnable/declaration.d index 0b6c6b5..0dbd287 100644 --- a/gcc/testsuite/gdc.test/runnable/declaration.d +++ b/gcc/testsuite/gdc.test/runnable/declaration.d @@ -1,3 +1,16 @@ +/* +TEST_OUTPUT: +--- +S7019(16), 16 +S7019(24), 24 +S7019(32), 32 +--- + +RUN_OUTPUT: +--- +Success +--- +*/ extern(C) int printf(const char*, ...); diff --git a/gcc/testsuite/gdc.test/runnable/foreach5.d b/gcc/testsuite/gdc.test/runnable/foreach5.d index 59ee906..003a34a 100644 --- a/gcc/testsuite/gdc.test/runnable/foreach5.d +++ b/gcc/testsuite/gdc.test/runnable/foreach5.d @@ -1,3 +1,16 @@ +/* +TEST_OUTPUT: +--- +int +double +foobar7406(T) +test7406() +int +foobar7406(T) +int +test7406() +--- +*/ extern(C) int printf(const char* fmt, ...); diff --git a/gcc/testsuite/gdc.test/runnable/funclit.d b/gcc/testsuite/gdc.test/runnable/funclit.d index d18e88a..c299bad 100644 --- a/gcc/testsuite/gdc.test/runnable/funclit.d +++ b/gcc/testsuite/gdc.test/runnable/funclit.d @@ -1,3 +1,19 @@ +/* +TEST_OUTPUT: +--- +int delegate() pure nothrow @nogc @safe delegate() pure nothrow @nogc @safe delegate() pure nothrow @safe +int delegate() pure nothrow @nogc @safe delegate() pure nothrow @nogc @safe delegate() pure nothrow @safe +int +int +int[] +int delegate() pure nothrow @nogc @safe function() pure nothrow @safe +--- + +RUN_OUTPUT: +--- +Success +--- +*/ import core.vararg; extern (C) int printf(const char*, ...); @@ -1226,6 +1242,66 @@ void test15794() } /***************************************************/ +// https://issues.dlang.org/show_bug.cgi?id=16271 + +ref auto funa16271(alias dg, T)(ref T a) +{ + return dg(a); +} + +ref auto func16271(alias dg)() +{ + return dg(); +} + +void assign16271(T)(ref T a, T b) +{ + alias fun = ref (ref a) => a; + fun(a) = b; +} + +void test16271() +{ + int x; + (ref () => x )() = 1; assert(x == 1); + func16271!(ref () => x) = 2; assert(x == 2); + assign16271(x, 3); assert(x == 3); + + alias alx = func16271!(ref () => x); + alx = 4; assert(x == 4); + + alias alf = ref (ref a) => a; + auto auf = ref (ref int a) => a; + alf(x) = 5; assert(x == 5); + auf(x) = 6; assert(x == 6); + + assert((funa16271!( ref (ref a) => a)(x) += 1) == 7 ); + assert((funa16271!(function ref (ref a) => a)(x) += 1) == 8 ); + assert((funa16271!(function ref int(ref a) => a)(x) += 1) == 9 ); + assert((funa16271!(delegate ref (ref a) => a)(x) += 1) == 10); + assert((funa16271!(delegate ref int(ref a) => a)(x) += 1) == 11); + assert(x == 11); + + alias aldc = ref () @trusted @nogc { return x; }; + auto audc = ref () @safe nothrow { return x; }; + alias alfuc = function ref (ref x) @trusted { return x; }; + alias aldec = delegate ref () @trusted { return x; }; + aldc() = 12; assert(x == 12); + audc() = 13; assert(x == 13); + alfuc(x) = 14; assert(x == 14); + aldec() = 15; assert(x == 15); + + template T() + { + int x; + alias alf = ref () => x; + auto auf = ref () => x; + } + T!().alf() = 1; assert(T!().x == 1); + T!().auf() = 2; assert(T!().x == 2); +} + +/***************************************************/ int main() { @@ -1283,6 +1359,7 @@ int main() test13879(); test14745(); test15794(); + test16271(); printf("Success\n"); return 0; diff --git a/gcc/testsuite/gdc.test/runnable/future.d b/gcc/testsuite/gdc.test/runnable/future.d index 0b6fd95..1a91d30 100644 --- a/gcc/testsuite/gdc.test/runnable/future.d +++ b/gcc/testsuite/gdc.test/runnable/future.d @@ -1,4 +1,8 @@ /* PERMUTE_ARGS: +TEST_OUTPUT: +--- +runnable/future.d(15): Deprecation: `@__future` base class method `future.A.msg` is being overridden by `future.B.msg`; rename the latter +--- */ class A diff --git a/gcc/testsuite/gdc.test/runnable/imports/link15194std.d b/gcc/testsuite/gdc.test/runnable/imports/link15194std.d index 95c63ce..baa9d55 100644 --- a/gcc/testsuite/gdc.test/runnable/imports/link15194std.d +++ b/gcc/testsuite/gdc.test/runnable/imports/link15194std.d @@ -30,7 +30,6 @@ else struct SetUnion(Rs...) { - pragma(msg, Rs); Rs r; // Rs[0] == RBRange!(RBNode!int*) diff --git a/gcc/testsuite/gdc.test/runnable/imports/test18322import.d b/gcc/testsuite/gdc.test/runnable/imports/test18322import.d new file mode 100644 index 0000000..8916cfd --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable/imports/test18322import.d @@ -0,0 +1,14 @@ +module test18322import; +void fun(string templateFileFullPath = __FILE_FULL_PATH__, + string templateFile = __FILE__)(string expectedFilename, string fileFullPath = __FILE_FULL_PATH__) +{ + // make sure it is an absolute path + version(Windows) + assert(fileFullPath[1..3] == ":\\"); + else + assert(fileFullPath[0] == '/'); + + assert(templateFileFullPath == fileFullPath); + assert(fileFullPath[$ - expectedFilename.length .. $] == expectedFilename); + assert(fileFullPath[$ - templateFile.length .. $] == templateFile); +} diff --git a/gcc/testsuite/gdc.test/runnable/interpret.d b/gcc/testsuite/gdc.test/runnable/interpret.d index b822cad..fe44744 100644 --- a/gcc/testsuite/gdc.test/runnable/interpret.d +++ b/gcc/testsuite/gdc.test/runnable/interpret.d @@ -1,4 +1,22 @@ -// RUNNABLE_PHOBOS_TEST +/* RUNNABLE_PHOBOS_TEST +TEST_OUTPUT: +--- +true +g +&Test109S(&Test109S(<recursion>)) +runnable/interpret.d(3197): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/interpret.d(3199): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/interpret.d(3202): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/interpret.d(3205): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/interpret.d(3206): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/interpret.d(3212): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/interpret.d(3213): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/interpret.d(3216): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +tfoo +tfoo +Crash! +--- +*/ import std.stdio; template Tuple(A...) diff --git a/gcc/testsuite/gdc.test/runnable/lazy.d b/gcc/testsuite/gdc.test/runnable/lazy.d index b9d0fd2..c184619 100644 --- a/gcc/testsuite/gdc.test/runnable/lazy.d +++ b/gcc/testsuite/gdc.test/runnable/lazy.d @@ -75,7 +75,7 @@ void test1() ); whiler( x < 100, - (printf("%d\n", x), x *= 2) + (){ printf("%d\n", x); x *= 2; }() ); } diff --git a/gcc/testsuite/gdc.test/runnable/link10920.d b/gcc/testsuite/gdc.test/runnable/link10920.d index 29f3a47..7c3e3de 100644 --- a/gcc/testsuite/gdc.test/runnable/link10920.d +++ b/gcc/testsuite/gdc.test/runnable/link10920.d @@ -1,4 +1,5 @@ // PERMUTE_ARGS: -version=A +// EXTRA_FILES: imports/link10920a.d // It's imported but won't be linked. import imports.link10920a; @@ -10,7 +11,7 @@ void main() { // Run semantic3 of BitArray.toString() // before the FormatSpec instantiation in main(). - pragma(msg, typeof(ba.toString())); + static assert(is(typeof(ba.toString()))); } // The instance codegen should be run always, unrelated with -version=A. diff --git a/gcc/testsuite/gdc.test/runnable/link15021.d b/gcc/testsuite/gdc.test/runnable/link15021.d index 62918a2..2e82610 100644 --- a/gcc/testsuite/gdc.test/runnable/link15021.d +++ b/gcc/testsuite/gdc.test/runnable/link15021.d @@ -1,4 +1,11 @@ // PERMUTE_ARGS: -inline -g -debug -unittest +// EXTRA_FILES: imports/std15021conv.d +/* +TEST_OUTPUT: +--- +hit! +--- +*/ import imports.std15021conv; diff --git a/gcc/testsuite/gdc.test/runnable/link6574.d b/gcc/testsuite/gdc.test/runnable/link6574.d index ab5e552..53e95f2 100644 --- a/gcc/testsuite/gdc.test/runnable/link6574.d +++ b/gcc/testsuite/gdc.test/runnable/link6574.d @@ -1,4 +1,14 @@ // PERMUTE_ARGS: +// EXTRA_FILES: imports/testmangle.d +/* +TEST_OUTPUT: +--- +_D7imports10testmangle12detectMangleFPSQBlQBg6DetectZQq +_D7imports10testmangle__T10DetectTmplTiZQpFNaNbNiNfZv +true +false +--- +*/ module link6574; import imports.testmangle; diff --git a/gcc/testsuite/gdc.test/runnable/mangle.d b/gcc/testsuite/gdc.test/runnable/mangle.d index 883d58a..9a8420a 100644 --- a/gcc/testsuite/gdc.test/runnable/mangle.d +++ b/gcc/testsuite/gdc.test/runnable/mangle.d @@ -1,5 +1,15 @@ // PERMUTE_ARGS: // EXTRA_SOURCES: imports/mangle10077.d +// EXTRA_FILES: imports/testmangle.d +/* +TEST_OUTPUT: +--- +_D7imports10testmangle12detectMangleFPSQBlQBg6DetectZQq +_D7imports10testmangle__T10DetectTmplTiZQpFNaNbNiNfZv +true +false +--- +*/ import imports.testmangle; @@ -589,6 +599,12 @@ void fooB(void delegate (void delegate()) scope dg) //pragma(msg, fooB.mangleof); static assert(typeof(fooA).mangleof != typeof(fooB).mangleof); +/***************************************************/ + +alias noreturn = typeof(*null); +alias fpd = noreturn function(); +int funcd(fpd); +static assert(funcd.mangleof == "_D6mangle5funcdFPFZNnZi"); /***************************************************/ diff --git a/gcc/testsuite/gdc.test/runnable/mixin2.d b/gcc/testsuite/gdc.test/runnable/mixin2.d index 3591d12..26a2352 100644 --- a/gcc/testsuite/gdc.test/runnable/mixin2.d +++ b/gcc/testsuite/gdc.test/runnable/mixin2.d @@ -1,4 +1,36 @@ -// RUNNABLE_PHOBOS_TEST +/* RUNNABLE_PHOBOS_TEST +TEST_OUTPUT: +--- +hello +hello + + + +hello +hello +--- + +RUN_OUTPUT: +--- +31 +42 +53 +64 +75 +86 +97 +108 +119 +1210 +5 +test4 +Constructor + Inside Scope +Destructor +hey +Success +--- +*/ import std.stdio; /*********************************************/ diff --git a/gcc/testsuite/gdc.test/runnable/nested.d b/gcc/testsuite/gdc.test/runnable/nested.d index fa012b5..6b2fcb0 100644 --- a/gcc/testsuite/gdc.test/runnable/nested.d +++ b/gcc/testsuite/gdc.test/runnable/nested.d @@ -1,4 +1,10 @@ // REQUIRED_ARGS: +/* +TEST_OUTPUT: +--- +null +--- +*/ import core.stdc.stdio; diff --git a/gcc/testsuite/gdc.test/runnable/noreturn1.d b/gcc/testsuite/gdc.test/runnable/noreturn1.d new file mode 100644 index 0000000..447ea28 --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable/noreturn1.d @@ -0,0 +1,74 @@ +alias noreturn = typeof(*null); + +extern (C) noreturn exit(); + +/*****************************************/ + +bool testf(int i) +{ + return i && assert(0); +} + +bool testt(int i) +{ + return i || assert(0); +} + +int testa(int i) +{ + if (i && exit()) + return i + 1; + return i - 1; +} + +int testb(int i) +{ + if (i || exit()) + return i + 1; + return i - 1; +} + +void test1() +{ + assert(testf(0) == false); + assert(testt(1) == true); + + assert(testa(0) == -1); + assert(testb(3) == 4); +} + +/*****************************************/ + +noreturn exit1() { assert(0); } +noreturn exit2() { assert(0); } + + +int heli1(int i) +{ + return i ? exit1() : i - 1; +} + +int heli2(int i) +{ + return i ? i - 1 : exit1(); +} + +noreturn heli3(int i) +{ + return i ? exit1() : exit2(); +} + +void test2() +{ + assert(heli1(0) == -1); + assert(heli2(1) == 0); +} + +/*****************************************/ + +int main() +{ + test1(); + test2(); + return 0; +} diff --git a/gcc/testsuite/gdc.test/runnable/nulltype.d b/gcc/testsuite/gdc.test/runnable/nulltype.d index c400d7f..7a1f1c3 100644 --- a/gcc/testsuite/gdc.test/runnable/nulltype.d +++ b/gcc/testsuite/gdc.test/runnable/nulltype.d @@ -1,3 +1,16 @@ +/* +TEST_OUTPUT: +--- +pure nothrow @safe Object(bool b) +pure nothrow @safe int*(bool b) +pure nothrow @safe int[](bool b) +--- + +RUN_OUTPUT: +--- +Success +--- +*/ extern (C) int printf(const(char*) fmt, ...); alias typeof(null) null_t; diff --git a/gcc/testsuite/gdc.test/runnable/property2.d b/gcc/testsuite/gdc.test/runnable/property2.d index 0735b93..1c5cf30 100644 --- a/gcc/testsuite/gdc.test/runnable/property2.d +++ b/gcc/testsuite/gdc.test/runnable/property2.d @@ -1,4 +1,24 @@ // PERMUTE_ARGS: -property +/* +TEST_OUTPUT: +--- +decl: test +stmt: test +--- + +RUN_OUTPUT: +--- +0: getter +1: setter +2: getter +3: setter +4: setter +5: compile error +6: compile error +7: setter +Success +--- +*/ extern (C) int printf(const char* fmt, ...); diff --git a/gcc/testsuite/gdc.test/runnable/runnable.exp b/gcc/testsuite/gdc.test/runnable/runnable.exp index af5d749..134d067 100644 --- a/gcc/testsuite/gdc.test/runnable/runnable.exp +++ b/gcc/testsuite/gdc.test/runnable/runnable.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Free Software Foundation, Inc. +# Copyright (C) 2020-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/gdc.test/runnable/sdtor.d b/gcc/testsuite/gdc.test/runnable/sdtor.d index ed58bcf..3edf8cf 100644 --- a/gcc/testsuite/gdc.test/runnable/sdtor.d +++ b/gcc/testsuite/gdc.test/runnable/sdtor.d @@ -1,4 +1,18 @@ // PERMUTE_ARGS: -unittest -O -release -inline -fPIC -g +/* +TEST_OUTPUT: +--- +runnable/sdtor.d(36): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/sdtor.d(59): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/sdtor.d(93): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/sdtor.d(117): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/sdtor.d(143): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/sdtor.d(177): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/sdtor.d(203): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +runnable/sdtor.d(276): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead. +S7353 +--- +*/ import core.vararg; @@ -879,8 +893,10 @@ void test34() X34[2] xs; // xs[0][0] = X34(); printf("foreach\n"); - for (int j = 0; j < xs.length; j++) { auto x = (j++,j--,xs[j]); - //foreach(x; xs) { + for (int j = 0; j < xs.length; j++) { + j++,j--; + auto x = xs[j]; + //foreach(x; xs) //printf("foreach x.i = %d\n", x[0].i); //assert(x[0].i == 1); printf("foreach x.i = %d\n", x.i); @@ -1395,22 +1411,22 @@ void test54() assert(S54.t == "c"); { S54.t = null; - int b = 1 && (bar54(S54(1)), 1); + int b = 1 && (){ bar54(S54(1)); return 1;}(); } assert(S54.t == "ac"); { S54.t = null; - int b = 0 && (bar54(S54(1)), 1); + int b = 0 && (){ bar54(S54(1)); return 1;}(); } assert(S54.t == ""); { S54.t = null; - int b = 0 || (bar54(S54(1)), 1); + int b = 0 || (){ bar54(S54(1)); return 1;}(); } assert(S54.t == "ac"); { S54.t = null; - int b = 1 || (bar54(S54(1)), 1); + int b = 1 || (){ bar54(S54(1)); return 1;}(); } assert(S54.t == ""); @@ -1529,7 +1545,8 @@ void test57() printf("----\n"); //+ dtor_cnt = 0; - if (auto s = (S57(1), S57(2), S57(10))) + S57(1), S57(2); + if (auto s = S57(10)) { assert(dtor_cnt == 2); printf("ifbody\n"); @@ -1562,7 +1579,8 @@ void test57() printf("----\n"); //+ dtor_cnt = 0; - if (auto s = (f(1), f(2), f(10))) + f(1), f(2); + if (auto s = f(10)) { assert(dtor_cnt == 2); printf("ifbody\n"); @@ -1596,7 +1614,8 @@ void test57() printf("----\n"); dtor_cnt = 0; - if ((S57(1), S57(2), S57(10))) + S57(1), S57(2); + if (S57(10)) { assert(dtor_cnt == 3); printf("ifbody\n"); @@ -1628,7 +1647,8 @@ void test57() printf("----\n"); dtor_cnt = 0; - if ((f(1), f(2), f(10))) + f(1), f(2); + if (f(10)) { assert(dtor_cnt == 3); printf("ifbody\n"); @@ -4432,7 +4452,8 @@ struct S64 S64 foo64() { - return S64((X64(), 1)); + X64(); + return S64(1); } void test64() diff --git a/gcc/testsuite/gdc.test/runnable/stress.d b/gcc/testsuite/gdc.test/runnable/stress.d index b157253..a8c6c91 100644 --- a/gcc/testsuite/gdc.test/runnable/stress.d +++ b/gcc/testsuite/gdc.test/runnable/stress.d @@ -89,8 +89,8 @@ void MDCHAR() if(str[ITERS-1][0].sizeof != (typ).sizeof) printf("Size Error: %d\n",str[ITERS-1][0].sizeof); foreach(s; str) { - int lstart; - foreach(int idx, char c; s) { + size_t lstart; + foreach(size_t idx, char c; s) { if(c == '\n') { typ[] t = s[lstart..idx]; if(t != "TEST LINE") { @@ -108,8 +108,8 @@ void MDCHAR() } foreach(s; splitLines(cast(string)tmp)) { - int lstart; - foreach(int idx, char c; s) { + size_t lstart; + foreach(size_t idx, char c; s) { if(c == '\n') { if(s[lstart..idx] != "TEST LINE") { printf("Error testing character array\n"); @@ -134,8 +134,8 @@ void CHAR() if(str.length != (ITERS * 10)) printf("Length Error: %d\n",str.length); if(str.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",str.sizeof); - int lstart; - foreach(int idx, char c; str) { + size_t lstart; + foreach(size_t idx, char c; str) { if(c == '\n') { if(str[lstart..idx] != "TEST LINE") { printf("Error testing character array\n"); @@ -159,8 +159,8 @@ void WCHAR() if(str.length != (ITERS * 10)) printf("Length Error: %d\n",str.length); if(str.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",str.sizeof); - int lstart; - foreach(int idx, char c; str) { + size_t lstart; + foreach(size_t idx, char c; str) { if(c == '\n') { if(str[lstart..idx] != toUTF16(cast(char[])"TEST LINE")) { printf("Error testing character array\n"); @@ -184,8 +184,8 @@ void DCHAR() if(str.length != (ITERS * 10)) printf("Length Error: %d\n",str.length); if(str.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",str.sizeof); - int lstart; - foreach(int idx, char c; str) { + size_t lstart; + foreach(size_t idx, char c; str) { if(c == '\n') { if(str[lstart..idx] != toUTF32(cast(char[])"TEST LINE")) { printf("Error testing character array\n"); diff --git a/gcc/testsuite/gdc.test/runnable/structlit.d b/gcc/testsuite/gdc.test/runnable/structlit.d index 9adcc7d..38af612 100644 --- a/gcc/testsuite/gdc.test/runnable/structlit.d +++ b/gcc/testsuite/gdc.test/runnable/structlit.d @@ -1295,7 +1295,7 @@ struct Z11256c(Ranges...) struct F11256(alias pred) { - this(int[] = null) { } + this(int[]) { } } Z!Ranges z11256(alias Z, Ranges...)(Ranges ranges) @@ -1305,9 +1305,9 @@ Z!Ranges z11256(alias Z, Ranges...)(Ranges ranges) void test11256() { - z11256!Z11256a(S11256.init, F11256!(gv => true)()); - z11256!Z11256b(S11256.init, F11256!(gv => true)()); - z11256!Z11256c(S11256.init, F11256!(gv => true)()); + z11256!Z11256a(S11256.init, F11256!(gv => true)(null)); + z11256!Z11256b(S11256.init, F11256!(gv => true)(null)); + z11256!Z11256c(S11256.init, F11256!(gv => true)(null)); } /********************************************/ diff --git a/gcc/testsuite/gdc.test/runnable/template3.d b/gcc/testsuite/gdc.test/runnable/template3.d index 0c03ca3..e331367 100644 --- a/gcc/testsuite/gdc.test/runnable/template3.d +++ b/gcc/testsuite/gdc.test/runnable/template3.d @@ -1,3 +1,18 @@ +/* +TEST_OUTPUT: +--- +instantiating... +instantiating... +last instantiation!!! +--- + +RUN_OUTPUT: +--- +1 +3 +Success +--- +*/ import core.stdc.stdio; diff --git a/gcc/testsuite/gdc.test/runnable/template4.d b/gcc/testsuite/gdc.test/runnable/template4.d index 81723f6..0381d89 100644 --- a/gcc/testsuite/gdc.test/runnable/template4.d +++ b/gcc/testsuite/gdc.test/runnable/template4.d @@ -1,4 +1,15 @@ -// RUNNABLE_PHOBOS_TEST +/* RUNNABLE_PHOBOS_TEST +TEST_OUTPUT: +--- +This actually gets evaluated! +() +(bool) +(bool, short) +(bool, short, int) +Alias Test instantiated +Alias Test instantiated +--- +*/ import std.stdio; import core.stdc.stdio; diff --git a/gcc/testsuite/gdc.test/runnable/template8.d b/gcc/testsuite/gdc.test/runnable/template8.d index ce0edf1..3f70687 100644 --- a/gcc/testsuite/gdc.test/runnable/template8.d +++ b/gcc/testsuite/gdc.test/runnable/template8.d @@ -36,17 +36,17 @@ private string CreateAccessors( static assert(len == 1); // getter result ~= "bool " ~ name ~ "(){ return " - "("~store~" & "~toStringSfx(maskAllElse)~") != 0;}"; + ~ "("~store~" & "~toStringSfx(maskAllElse)~") != 0;}"; // setter result ~= "void " ~ name ~ "(bool v){" - "if (v) "~store~" |= "~toStringSfx(maskAllElse)~";" - "else "~store~" &= "~toStringSfx(maskMyself)~";}"; + ~ "if (v) "~store~" |= "~toStringSfx(maskAllElse)~";" + ~ "else "~store~" &= "~toStringSfx(maskMyself)~";}"; } else { // getter result ~= T.stringof ~ " " ~ name ~ "(){ auto result = " - "("~store~" & " + ~ "("~store~" & " ~ toStringSfx(maskAllElse) ~ ") >>" ~ toStringSfx(offset) ~ ";"; static if (T.min < 0) diff --git a/gcc/testsuite/gdc.test/runnable/template9.d b/gcc/testsuite/gdc.test/runnable/template9.d index b016ff9..486eb67 100644 --- a/gcc/testsuite/gdc.test/runnable/template9.d +++ b/gcc/testsuite/gdc.test/runnable/template9.d @@ -1,5 +1,53 @@ -// RUNNABLE_PHOBOS_TEST -// PERMUTE_ARGS: +/* RUNNABLE_PHOBOS_TEST +PERMUTE_ARGS: +EXTRA_FILES: imports/testmangle.d +TEST_OUTPUT: +--- +func +double +All good 1 +All good 2 +All good 3 +_D7imports10testmangle12detectMangleFPSQBlQBg6DetectZQq +_D7imports10testmangle__T10DetectTmplTiZQpFNaNbNiNfZv +true +false +uint +int[] +int[] +const(K5886) +4 ; const(K5886) +8 ; const(K5886) +K5886 +immutable(K5886) +4 ; K5886 +4 ; immutable(K5886) +1 ; K5886 +2 ; const(K5886) +3 ; immutable(K5886) +8 ; K5886 +9 ; const(K5886) +10 ; immutable(K5886) +> U = int, N:$?:64=ulong = 3LU|32=uint = 3u$ +K=string, V=int +K=char, V=string +T = SA, E = int, dim = $?:64=5LU|32=5u$ +T = DA, E = int +T = AA, K = string, V = int +pure nothrow @nogc @safe void(int t) +pure nothrow @nogc @safe void(int t) +T = byte +T = char +--- + +RUN_OUTPUT: +--- +typeof(T)=double typeof(S)=int +typeof(T)=double typeof(S)=int +typeof(T)=float typeof(S)=int +Success +--- +*/ module breaker; diff --git a/gcc/testsuite/gdc.test/runnable/test15.d b/gcc/testsuite/gdc.test/runnable/test15.d index 234f50b..405171e 100644 --- a/gcc/testsuite/gdc.test/runnable/test15.d +++ b/gcc/testsuite/gdc.test/runnable/test15.d @@ -901,12 +901,12 @@ void test49() void foo50(int[] f, ...) { - foreach(int i, TypeInfo ti; _arguments) { } + foreach(size_t i, TypeInfo ti; _arguments) { } } void bar50(out int[] f, ...) { - foreach(int i, TypeInfo ti; _arguments) { } + foreach(size_t i, TypeInfo ti; _arguments) { } } void test50() diff --git a/gcc/testsuite/gdc.test/runnable/test17373.d b/gcc/testsuite/gdc.test/runnable/test17373.d new file mode 100644 index 0000000..93753ba --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable/test17373.d @@ -0,0 +1,20 @@ +interface Foo { void visit (int); } +interface Bar { void visit(double); } +interface FooBar : Foo, Bar {} +static assert(__traits(getOverloads, FooBar, "visit").length == 2); + +interface Fbar { void visit(char); void visit(double); } +interface Triple : Foo, Bar, Fbar {} +static assert(__traits(getOverloads, Triple, "visit").length == 3); + +interface InheritanceMadness : FooBar, Triple {} +static assert(__traits(getOverloads, Triple, "visit").length == 3); + +interface Simple +{ + int square(int); + real square(real); +} +static assert(__traits(getOverloads, Simple, "square").length == 2); + +void main() {} diff --git a/gcc/testsuite/gdc.test/runnable/test17878.d b/gcc/testsuite/gdc.test/runnable/test17878.d new file mode 100644 index 0000000..77b5a52 --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable/test17878.d @@ -0,0 +1,19 @@ +@__future int foo() +{ + return 0; +} + +int bar() +{ + return 1; +} + +@__future int c; + + +void main() +{ + static assert(__traits(isFuture, foo)); + static assert(!__traits(isFuture, bar)); + static assert(__traits(isFuture, c)); +} diff --git a/gcc/testsuite/gdc.test/runnable/test18322.d b/gcc/testsuite/gdc.test/runnable/test18322.d new file mode 100644 index 0000000..97e2e97 --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable/test18322.d @@ -0,0 +1,21 @@ +/* +REQUIRED_ARGS: -Irunnable/imports +COMPILED_IMPORTS: imports/test18322import.d +PERMUTE_ARGS: +*/ +import test18322import; +void main(){ + version(Windows) + auto sep = "\\"; + else + auto sep = "/"; + + auto filename = "runnable" ~ sep ~ "test18322.d"; + + fun(filename); + mixin(`fun(filename ~ "-mixin-16");`); + + #line 100 "poundlinefile.d" + fun("poundlinefile.d"); + mixin(`fun("poundlinefile.d-mixin-101");`); +} diff --git a/gcc/testsuite/gdc.test/runnable/test22.d b/gcc/testsuite/gdc.test/runnable/test22.d index bd04878..2aabb4d 100644 --- a/gcc/testsuite/gdc.test/runnable/test22.d +++ b/gcc/testsuite/gdc.test/runnable/test22.d @@ -202,7 +202,9 @@ class B9 { A9 test1 = new A9(1, 2, 3); A9 test2 = new A9(1, 2, 3, 4); - int[3] arg; A9 test3 = new A9((arg[0]=1, arg[1]=2, arg[2]=3, arg)); + int[3] arg; + arg[0]=1, arg[1]=2, arg[2]=3; + A9 test3 = new A9(arg); } } diff --git a/gcc/testsuite/gdc.test/runnable/test34.d b/gcc/testsuite/gdc.test/runnable/test34.d index 6e2b368..e38ab1c 100644 --- a/gcc/testsuite/gdc.test/runnable/test34.d +++ b/gcc/testsuite/gdc.test/runnable/test34.d @@ -1,4 +1,11 @@ // RUNNABLE_PHOBOS_TEST +/* +TEST_OUTPUT: +--- +Object +--- +*/ + module test34; import std.stdio; diff --git a/gcc/testsuite/gdc.test/runnable/test42.d b/gcc/testsuite/gdc.test/runnable/test42.d index 66b3c04..e887fae 100644 --- a/gcc/testsuite/gdc.test/runnable/test42.d +++ b/gcc/testsuite/gdc.test/runnable/test42.d @@ -1,8 +1,18 @@ -// RUNNABLE_PHOBOS_TEST -// REQUIRED_ARGS: +/* RUNNABLE_PHOBOS_TEST +REQUIRED_ARGS: +TEST_OUTPUT: +--- +success +myInt int +myBool bool +i +s +C6test42__T4T219TiZ1C +C6test427test219FZ8__mixin11C +--- +*/ module test42; - import std.stdio; import core.stdc.stdio; import std.string; @@ -52,7 +62,7 @@ void test3() { auto i = mixin("__LINE__"); writefln("%d", i); - assert(i == 53); + assert(i == 63); } /***************************************************/ @@ -1092,17 +1102,17 @@ void test71() { size_t s = Foo71!( "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" -"When dealing with complex template tuples, it's very easy to overflow the +~ "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +~ "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +~ "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +~ "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +~ "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +~ "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +~ "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +~ "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +~ "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +~ "helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +~ "When dealing with complex template tuples, it's very easy to overflow the maximum symbol length allowed by OPTLINK. This is, simply put, a damn shame, because it prevents otherwise completely legal code from compiling and linking with DMDWin, whereas it works perfectly fine when using DMDNix or GDC. @@ -1980,7 +1990,7 @@ struct Foobar; int test124() { int result; dchar[] aa; - alias uint foo_t; + alias size_t foo_t; foreach (foo_t i, dchar d; aa) { @@ -3507,7 +3517,7 @@ void test215() enum assocarrayliteral = Q!( [1:2] ).q.stringof; enum complex80 = Q!( 1+1.0i ).q.stringof; //enum dottype = Q!( C.Object.toString ).q.stringof; - enum halt = (assert(0), 0).stringof; // ICE w/ -release + enum halt = 0.stringof; // ICE w/ -release //enum remove = Q!( [1:2].remove(1) ).q.stringof; enum templat = Q!( Q ).q.stringof; } diff --git a/gcc/testsuite/gdc.test/runnable/test8.d b/gcc/testsuite/gdc.test/runnable/test8.d index f8b800f..4927bbc 100644 --- a/gcc/testsuite/gdc.test/runnable/test8.d +++ b/gcc/testsuite/gdc.test/runnable/test8.d @@ -696,7 +696,7 @@ void test38() printf("Count: %d\n", count); assert(count == 1028); } - catch + catch(Throwable) { printf("Exception: %d\n", k); assert(0); diff --git a/gcc/testsuite/gdc.test/runnable/testaa.d b/gcc/testsuite/gdc.test/runnable/testaa.d index 75e8172..34cc705 100644 --- a/gcc/testsuite/gdc.test/runnable/testaa.d +++ b/gcc/testsuite/gdc.test/runnable/testaa.d @@ -512,7 +512,7 @@ int foo17() }catch(Error e){ assert(e); return 0; - }catch{ + }catch(Throwable){ assert(0); } assert(0); diff --git a/gcc/testsuite/gdc.test/runnable/testaa2.d b/gcc/testsuite/gdc.test/runnable/testaa2.d index d925603..17de167 100644 --- a/gcc/testsuite/gdc.test/runnable/testaa2.d +++ b/gcc/testsuite/gdc.test/runnable/testaa2.d @@ -151,7 +151,7 @@ void test3825() * it has no side effect. Then optimizer eliminate it completely, and * whole expression succeed to run in runtime. */ int n = 0; - assert(thrown(aax[(n=aax[1], 0)] = 0)); // accessing aax[1] in key part, throws OK + assert(thrown(aax[((){ n=aax[1]; return 0;}())] = 0)); // accessing aax[1] in key part, throws OK // This works as expected. int[int][int] aaa; diff --git a/gcc/testsuite/gdc.test/runnable/testassign.d b/gcc/testsuite/gdc.test/runnable/testassign.d index f20da4a..b000967 100644 --- a/gcc/testsuite/gdc.test/runnable/testassign.d +++ b/gcc/testsuite/gdc.test/runnable/testassign.d @@ -1,3 +1,23 @@ +/* +TEST_OUTPUT: +--- +\ S1 S2a S2b S3a S3b S4a S4b +- true true true true true true true +Xa true true true true true true true +Xb true true true true true true true +Xc true true true true true true true +Xd true true true true true true true +Xe true true true true true true true +Xf true true true true true true true +Xg true true true true true true true +--- + +RUN_OUTPUT: +--- +Success +--- +*/ + import core.stdc.stdio; template TypeTuple(T...){ alias T TypeTuple; } diff --git a/gcc/testsuite/gdc.test/runnable/testconst.d b/gcc/testsuite/gdc.test/runnable/testconst.d index 42f9c1b..7ec4245 100644 --- a/gcc/testsuite/gdc.test/runnable/testconst.d +++ b/gcc/testsuite/gdc.test/runnable/testconst.d @@ -1,3 +1,45 @@ +/* +TEST_OUTPUT: +--- +const(immutable(char)*) +inout(immutable(char)*) +inout(const(char)*) +inout(const(char)) +shared(inout(char)) +shared(inout(char)) +immutable(char) +immutable(char) +inout(const(char)) +inout(const(char)) +shared(const(char)) +shared(const(char)) +inout(char*****) +inout(char****)* +const(char*****) +const(char****)* +immutable(char*****) +immutable(char****)* +shared(char*****) +shared(char****)* +const(shared(char****)*) +shared(const(char*****)) +shared(char*****) +immutable(char*****) +inout(shared(char****)*) +inout(shared(char**)***) +shared(inout(char**)) +immutable(string) +const(char[]) +char[] +shared(foo85) +const(char[26]) +const(char[26]) +immutable(char[26]) +immutable(char[26]) +string +int[3] +--- +*/ import core.stdc.stdio; diff --git a/gcc/testsuite/gdc.test/runnable/testcontracts.d b/gcc/testsuite/gdc.test/runnable/testcontracts.d index 9a2639d..f99a10a 100644 --- a/gcc/testsuite/gdc.test/runnable/testcontracts.d +++ b/gcc/testsuite/gdc.test/runnable/testcontracts.d @@ -422,6 +422,56 @@ void test6417() } /*******************************************/ +// 6549 + +class C6549 +{ + static int ocount = 0; + static int icount = 0; + + abstract int foo(int) + in { ++icount; } + out { ++ocount; } +} + +class CD6549 : C6549 +{ + override int foo(int) + in { assert(false); } + do { return 10; } +} + +abstract class D6549 +{ + static int icount = 0; + static int ocount = 0; + + int foo(int) + in { ++icount; } + out { ++ocount; } +} + +class DD6549 : D6549 +{ + override int foo(int) + in { assert(false); } + do { return 10; } +} + +void test6549() +{ + auto c = new CD6549; + c.foo(10); + assert(C6549.icount == 1); + assert(C6549.ocount == 1); + + auto d = new DD6549; + d.foo(10); + assert(D6549.icount == 1); + assert(D6549.ocount == 1); +} + +/*******************************************/ // 7218 void test7218() @@ -1030,6 +1080,81 @@ void test14779() /*******************************************/ +//******************************************/ +// DIP 1009 + +int dip1009_1(int x) + in (x > 0, "x must be positive!") + out (r; r < 0, "r must be negative!") + in (true, "cover trailing comma case",) + out (; true, "cover trailing comma case",) +{ + return -x; +} + +int dip1009_2(int x) + in (x > 0) + out (r; r < 0) +{ + return -x; +} + +int dip1009_3(int x) +in (x > 0,) +out (r; r < 0,) +do +{ + return -x; +} + +void dip1009_4(int x) + in (x > 0) + out (; x > 1) +{ + x += 1; +} + +interface DIP1009_5 +{ + void dip1009_5(int x) + in (x > 0) + out (; x > 1); +} + +int dip1009_6(int x, int y) + in (x > 0) + out (r; r > 1) + out (; x > 0) + in (y > 0) + in (x + y > 1) + out (r; r > 1) +{ + return x+y; +} + +int dip1009_7(int x) + in (x > 0) + in { assert(x > 1); } + out { assert(x > 2); } + out (; x > 3) + out (r; r > 3) +{ + x += 2; + return x; +} + +class DIP1009_8 +{ + private int x = 4; + invariant (x > 0, "x must stay positive"); + invariant (x > 1, "x must be greater than one",); + invariant (x > 2); + invariant (x > 3,); + void foo(){ x = 5; } +} + +/*******************************************/ + int main() { test1(); @@ -1043,6 +1168,7 @@ int main() test9(); test4785(); test6417(); + test6549(); test7218(); test7517(); test8073(); @@ -1051,6 +1177,13 @@ int main() test15524(); test15524a(); test14779(); + dip1009_1(1); + dip1009_2(1); + dip1009_3(1); + dip1009_4(1); + dip1009_6(1, 1); + dip1009_7(3); + new DIP1009_8().foo(); printf("Success\n"); return 0; diff --git a/gcc/testsuite/gdc.test/runnable/testdstress.d b/gcc/testsuite/gdc.test/runnable/testdstress.d index f06f939..a416b8a 100644 --- a/gcc/testsuite/gdc.test/runnable/testdstress.d +++ b/gcc/testsuite/gdc.test/runnable/testdstress.d @@ -1,7 +1,7 @@ // RUNNABLE_PHOBOS_TEST // PERMUTE_ARGS: -module dstress.run.module_01; +module run.module_01; import core.memory; import core.exception; @@ -171,9 +171,9 @@ int i; void test7() { - assert(dstress.run.module_01.i==0); - dstress.run.module_01.i++; - assert(dstress.run.module_01.i==1); + assert(run.module_01.i==0); + run.module_01.i++; + assert(run.module_01.i==1); } /* ================================ */ @@ -414,7 +414,7 @@ void test19() { try{ throw new Alias19(); - }catch{ + }catch(Throwable){ return; } assert(0); @@ -484,7 +484,7 @@ void test23() { try{ foo23(); - }catch{ + }catch(Throwable){ } assert(status23==-1); } @@ -515,7 +515,7 @@ void test24() assert(status24==0); try{ check24(); - }catch{ + }catch(Throwable){ assert(status24==1); status24-=5; } @@ -700,7 +700,7 @@ void test32() assert(!(ti is null)); writefln("%s %d %d", ti.toString(), ti.tsize, (MyUnion32*).sizeof); assert(ti.tsize==(MyUnion32*).sizeof); - assert(ti.toString()=="dstress.run.module_01.MyUnion32*"); + assert(ti.toString()=="run.module_01.MyUnion32*"); } /* ================================ */ @@ -831,7 +831,7 @@ void test40() try{ assert(!checked40); GrandChild40 gc = new GrandChild40(); - }catch{ + }catch(Throwable){ assert(checked40); return; } diff --git a/gcc/testsuite/gdc.test/runnable/testenum.d b/gcc/testsuite/gdc.test/runnable/testenum.d index 9ecf97a..0532744 100644 --- a/gcc/testsuite/gdc.test/runnable/testenum.d +++ b/gcc/testsuite/gdc.test/runnable/testenum.d @@ -1,4 +1,10 @@ -// PERMUTE_ARGS: +/* +PERMUTE_ARGS: +RUN_OUTPUT: +--- +Success +--- +*/ extern(C) int printf(const char*, ...); @@ -189,7 +195,6 @@ void test2407() b = ES.b, c = ES.c, } - static assert(EES.init == ES.init); static assert(EES.init == S(1)); static assert(!__traits(compiles, EES.min)); static assert(!__traits(compiles, EES.max)); diff --git a/gcc/testsuite/gdc.test/runnable/testmodule.d b/gcc/testsuite/gdc.test/runnable/testmodule.d index 5d81588..45da7d1 100644 --- a/gcc/testsuite/gdc.test/runnable/testmodule.d +++ b/gcc/testsuite/gdc.test/runnable/testmodule.d @@ -9,13 +9,13 @@ // @uri@ news:ct428n$2qoe$1@digitaldaemon.com // @url@ nntp://news.digitalmars.com/D.gnu/983 -module dstress.run.unicode_06_哪里; +module run.unicode_06_哪里; int 哪里(int ö){ return ö+2; } int main(){ - assert(dstress.run.unicode_06_哪里.哪里(2)==4); + assert(run.unicode_06_哪里.哪里(2)==4); return 0; } diff --git a/gcc/testsuite/gdc.test/runnable/testrightthis.d b/gcc/testsuite/gdc.test/runnable/testrightthis.d index 1185132..32879ce 100644 --- a/gcc/testsuite/gdc.test/runnable/testrightthis.d +++ b/gcc/testsuite/gdc.test/runnable/testrightthis.d @@ -1,5 +1,11 @@ -// runnable/traits.d 9091,8972,8971,7027 -// runnable/test4.d test6() +/* +runnable/traits.d 9091,8972,8971,7027 +runnable/test4.d test6() +RUN_OUTPUT: +--- +Success +--- +*/ extern(C) int printf(const char*, ...); @@ -578,7 +584,6 @@ class Bar11245 { void func() { - pragma(msg, "===="); float[Vec11245.f.length] newVal; } } diff --git a/gcc/testsuite/gdc.test/runnable/testscope2.d b/gcc/testsuite/gdc.test/runnable/testscope2.d index 6c96fb5..85282c2 100644 --- a/gcc/testsuite/gdc.test/runnable/testscope2.d +++ b/gcc/testsuite/gdc.test/runnable/testscope2.d @@ -1,5 +1,14 @@ // RUNNABLE_PHOBOS_TEST // REQUIRED_ARGS: -dip25 +/* +TEST_OUTPUT: +--- +foo1 ulong function(return ref int* delegate() return p) ref return +foo2 int function(return ref int delegate() p) ref +foo3 int function(return ref inout(int*) p) ref +foo4 int function(return ref inout(int*) p) ref +--- +*/ import core.stdc.stdio; diff --git a/gcc/testsuite/gdc.test/runnable/traits.d b/gcc/testsuite/gdc.test/runnable/traits.d index 547976f..9d14ecd 100644 --- a/gcc/testsuite/gdc.test/runnable/traits.d +++ b/gcc/testsuite/gdc.test/runnable/traits.d @@ -1,5 +1,20 @@ // RUNNABLE_PHOBOS_TEST -// PERMUTE_ARGS: +/* +PERMUTE_ARGS: +EXTRA_FILES: imports/a9546.d + +Windows linker may write something like: +--- +Creating library {{RESULTS_DIR}}/runnable/traits_0.lib and object {{RESULTS_DIR}}/runnable/traits_0.exp +--- + +TRANSFORM_OUTPUT: remove_lines("Creating library") +TEST_OUTPUT: +--- +__lambda1 +--- +*/ + module traits; import std.stdio; @@ -12,6 +27,7 @@ class AC2 { abstract void foo(); } class AC3 : AC2 { } final class FC { void foo() { } } enum E { EMEM } +struct D1 { @disable void true_(); void false_(){} } /********************************************************/ @@ -623,7 +639,7 @@ struct Test24 private void test24(int, int){} } -static assert(__traits(getProtection, __traits(getOverloads, Test24, "test24")[1]) == "private"); +static assert(__traits(getVisibility, __traits(getOverloads, Test24, "test24")[1]) == "private"); /********************************************************/ // 1369 @@ -878,7 +894,7 @@ protected struct TestProt3 {} public struct TestProt4 {} export struct TestProt5 {} -void getProtection() +void getVisibility() { class Test { @@ -891,52 +907,52 @@ void getProtection() Test t; // TOKvar and VarDeclaration - static assert(__traits(getProtection, Test.va) == "private"); - static assert(__traits(getProtection, Test.vb) == "package"); - static assert(__traits(getProtection, Test.vc) == "protected"); - static assert(__traits(getProtection, Test.vd) == "public"); - static assert(__traits(getProtection, Test.ve) == "export"); + static assert(__traits(getVisibility, Test.va) == "private"); + static assert(__traits(getVisibility, Test.vb) == "package"); + static assert(__traits(getVisibility, Test.vc) == "protected"); + static assert(__traits(getVisibility, Test.vd) == "public"); + static assert(__traits(getVisibility, Test.ve) == "export"); // TOKdotvar and VarDeclaration - static assert(__traits(getProtection, t.va) == "private"); - static assert(__traits(getProtection, t.vb) == "package"); - static assert(__traits(getProtection, t.vc) == "protected"); - static assert(__traits(getProtection, t.vd) == "public"); - static assert(__traits(getProtection, t.ve) == "export"); + static assert(__traits(getVisibility, t.va) == "private"); + static assert(__traits(getVisibility, t.vb) == "package"); + static assert(__traits(getVisibility, t.vc) == "protected"); + static assert(__traits(getVisibility, t.vd) == "public"); + static assert(__traits(getVisibility, t.ve) == "export"); // TOKvar and FuncDeclaration - static assert(__traits(getProtection, Test.fa) == "private"); - static assert(__traits(getProtection, Test.fb) == "package"); - static assert(__traits(getProtection, Test.fc) == "protected"); - static assert(__traits(getProtection, Test.fd) == "public"); - static assert(__traits(getProtection, Test.fe) == "export"); + static assert(__traits(getVisibility, Test.fa) == "private"); + static assert(__traits(getVisibility, Test.fb) == "package"); + static assert(__traits(getVisibility, Test.fc) == "protected"); + static assert(__traits(getVisibility, Test.fd) == "public"); + static assert(__traits(getVisibility, Test.fe) == "export"); // TOKdotvar and FuncDeclaration - static assert(__traits(getProtection, t.fa) == "private"); - static assert(__traits(getProtection, t.fb) == "package"); - static assert(__traits(getProtection, t.fc) == "protected"); - static assert(__traits(getProtection, t.fd) == "public"); - static assert(__traits(getProtection, t.fe) == "export"); + static assert(__traits(getVisibility, t.fa) == "private"); + static assert(__traits(getVisibility, t.fb) == "package"); + static assert(__traits(getVisibility, t.fc) == "protected"); + static assert(__traits(getVisibility, t.fd) == "public"); + static assert(__traits(getVisibility, t.fe) == "export"); // TOKtype - static assert(__traits(getProtection, TestProt1) == "private"); - static assert(__traits(getProtection, TestProt2) == "package"); - static assert(__traits(getProtection, TestProt3) == "protected"); - static assert(__traits(getProtection, TestProt4) == "public"); - static assert(__traits(getProtection, TestProt5) == "export"); + static assert(__traits(getVisibility, TestProt1) == "private"); + static assert(__traits(getVisibility, TestProt2) == "package"); + static assert(__traits(getVisibility, TestProt3) == "protected"); + static assert(__traits(getVisibility, TestProt4) == "public"); + static assert(__traits(getVisibility, TestProt5) == "export"); // This specific pattern is important to ensure it always works // through reflection, however that becomes implemented - static assert(__traits(getProtection, __traits(getMember, t, "va")) == "private"); - static assert(__traits(getProtection, __traits(getMember, t, "vb")) == "package"); - static assert(__traits(getProtection, __traits(getMember, t, "vc")) == "protected"); - static assert(__traits(getProtection, __traits(getMember, t, "vd")) == "public"); - static assert(__traits(getProtection, __traits(getMember, t, "ve")) == "export"); - static assert(__traits(getProtection, __traits(getMember, t, "fa")) == "private"); - static assert(__traits(getProtection, __traits(getMember, t, "fb")) == "package"); - static assert(__traits(getProtection, __traits(getMember, t, "fc")) == "protected"); - static assert(__traits(getProtection, __traits(getMember, t, "fd")) == "public"); - static assert(__traits(getProtection, __traits(getMember, t, "fe")) == "export"); + static assert(__traits(getVisibility, __traits(getMember, t, "va")) == "private"); + static assert(__traits(getVisibility, __traits(getMember, t, "vb")) == "package"); + static assert(__traits(getVisibility, __traits(getMember, t, "vc")) == "protected"); + static assert(__traits(getVisibility, __traits(getMember, t, "vd")) == "public"); + static assert(__traits(getVisibility, __traits(getMember, t, "ve")) == "export"); + static assert(__traits(getVisibility, __traits(getMember, t, "fa")) == "private"); + static assert(__traits(getVisibility, __traits(getMember, t, "fb")) == "package"); + static assert(__traits(getVisibility, __traits(getMember, t, "fc")) == "protected"); + static assert(__traits(getVisibility, __traits(getMember, t, "fd")) == "public"); + static assert(__traits(getVisibility, __traits(getMember, t, "fe")) == "export"); } /********************************************************/ @@ -947,47 +963,47 @@ void test9546() import imports.a9546 : S; S s; - static assert(__traits(getProtection, s.privA) == "private"); - static assert(__traits(getProtection, s.protA) == "protected"); - static assert(__traits(getProtection, s.packA) == "package"); - static assert(__traits(getProtection, S.privA) == "private"); - static assert(__traits(getProtection, S.protA) == "protected"); - static assert(__traits(getProtection, S.packA) == "package"); - - static assert(__traits(getProtection, mixin("s.privA")) == "private"); - static assert(__traits(getProtection, mixin("s.protA")) == "protected"); - static assert(__traits(getProtection, mixin("s.packA")) == "package"); - static assert(__traits(getProtection, mixin("S.privA")) == "private"); - static assert(__traits(getProtection, mixin("S.protA")) == "protected"); - static assert(__traits(getProtection, mixin("S.packA")) == "package"); - - static assert(__traits(getProtection, __traits(getMember, s, "privA")) == "private"); - static assert(__traits(getProtection, __traits(getMember, s, "protA")) == "protected"); - static assert(__traits(getProtection, __traits(getMember, s, "packA")) == "package"); - static assert(__traits(getProtection, __traits(getMember, S, "privA")) == "private"); - static assert(__traits(getProtection, __traits(getMember, S, "protA")) == "protected"); - static assert(__traits(getProtection, __traits(getMember, S, "packA")) == "package"); - - static assert(__traits(getProtection, s.privF) == "private"); - static assert(__traits(getProtection, s.protF) == "protected"); - static assert(__traits(getProtection, s.packF) == "package"); - static assert(__traits(getProtection, S.privF) == "private"); - static assert(__traits(getProtection, S.protF) == "protected"); - static assert(__traits(getProtection, S.packF) == "package"); - - static assert(__traits(getProtection, mixin("s.privF")) == "private"); - static assert(__traits(getProtection, mixin("s.protF")) == "protected"); - static assert(__traits(getProtection, mixin("s.packF")) == "package"); - static assert(__traits(getProtection, mixin("S.privF")) == "private"); - static assert(__traits(getProtection, mixin("S.protF")) == "protected"); - static assert(__traits(getProtection, mixin("S.packF")) == "package"); - - static assert(__traits(getProtection, __traits(getMember, s, "privF")) == "private"); - static assert(__traits(getProtection, __traits(getMember, s, "protF")) == "protected"); - static assert(__traits(getProtection, __traits(getMember, s, "packF")) == "package"); - static assert(__traits(getProtection, __traits(getMember, S, "privF")) == "private"); - static assert(__traits(getProtection, __traits(getMember, S, "protF")) == "protected"); - static assert(__traits(getProtection, __traits(getMember, S, "packF")) == "package"); + static assert(__traits(getVisibility, s.privA) == "private"); + static assert(__traits(getVisibility, s.protA) == "protected"); + static assert(__traits(getVisibility, s.packA) == "package"); + static assert(__traits(getVisibility, S.privA) == "private"); + static assert(__traits(getVisibility, S.protA) == "protected"); + static assert(__traits(getVisibility, S.packA) == "package"); + + static assert(__traits(getVisibility, mixin("s.privA")) == "private"); + static assert(__traits(getVisibility, mixin("s.protA")) == "protected"); + static assert(__traits(getVisibility, mixin("s.packA")) == "package"); + static assert(__traits(getVisibility, mixin("S.privA")) == "private"); + static assert(__traits(getVisibility, mixin("S.protA")) == "protected"); + static assert(__traits(getVisibility, mixin("S.packA")) == "package"); + + static assert(__traits(getVisibility, __traits(getMember, s, "privA")) == "private"); + static assert(__traits(getVisibility, __traits(getMember, s, "protA")) == "protected"); + static assert(__traits(getVisibility, __traits(getMember, s, "packA")) == "package"); + static assert(__traits(getVisibility, __traits(getMember, S, "privA")) == "private"); + static assert(__traits(getVisibility, __traits(getMember, S, "protA")) == "protected"); + static assert(__traits(getVisibility, __traits(getMember, S, "packA")) == "package"); + + static assert(__traits(getVisibility, s.privF) == "private"); + static assert(__traits(getVisibility, s.protF) == "protected"); + static assert(__traits(getVisibility, s.packF) == "package"); + static assert(__traits(getVisibility, S.privF) == "private"); + static assert(__traits(getVisibility, S.protF) == "protected"); + static assert(__traits(getVisibility, S.packF) == "package"); + + static assert(__traits(getVisibility, mixin("s.privF")) == "private"); + static assert(__traits(getVisibility, mixin("s.protF")) == "protected"); + static assert(__traits(getVisibility, mixin("s.packF")) == "package"); + static assert(__traits(getVisibility, mixin("S.privF")) == "private"); + static assert(__traits(getVisibility, mixin("S.protF")) == "protected"); + static assert(__traits(getVisibility, mixin("S.packF")) == "package"); + + static assert(__traits(getVisibility, __traits(getMember, s, "privF")) == "private"); + static assert(__traits(getVisibility, __traits(getMember, s, "protF")) == "protected"); + static assert(__traits(getVisibility, __traits(getMember, s, "packF")) == "package"); + static assert(__traits(getVisibility, __traits(getMember, S, "privF")) == "private"); + static assert(__traits(getVisibility, __traits(getMember, S, "protF")) == "protected"); + static assert(__traits(getVisibility, __traits(getMember, S, "packF")) == "package"); } /********************************************************/ @@ -1548,6 +1564,28 @@ void async(ARGS...)(ARGS) alias test17495 = async!(int, int); /********************************************************/ +// 15094 + +void test15094() +{ + static struct Foo { int i; } + static struct Bar { Foo foo; } + + Bar bar; + auto n = __traits(getMember, bar.foo, "i"); + assert(n == bar.foo.i); +} + +/********************************************************/ + +void testIsDisabled() +{ + static assert(__traits(isDisabled, D1.true_)); + static assert(!__traits(isDisabled, D1.false_)); + static assert(!__traits(isDisabled, D1)); +} + +/********************************************************/ // https://issues.dlang.org/show_bug.cgi?id=10100 enum E10100 @@ -1603,6 +1641,7 @@ int main() test_getFunctionAttributes(); test_isOverrideFunction(); test12237(); + test15094(); writeln("Success"); return 0; diff --git a/gcc/testsuite/gdc.test/runnable/traits_child.d b/gcc/testsuite/gdc.test/runnable/traits_child.d new file mode 100644 index 0000000..056b8f1 --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable/traits_child.d @@ -0,0 +1,122 @@ +struct A +{ + ulong i; + void foo(ulong a) + { + i = a; + } + + void foo(string s) + { + i = s.length; + } + + void bar(T)(T a) + { + i = a; + } + + void bar(T : string)(T s) + { + i = s.length; + } +} + +alias ai = A.i; +alias afoo = A.foo; +alias abar = A.bar; +alias abar_ulong = A.bar!ulong; +alias abar_string = A.bar!string; + +struct B +{ + A a; +} + +alias ba = B.a; + +template T(alias x) +{ + void set(int n) + { + x = n; + } +} + +mixin template M(alias x) +{ + void set(int n) + { + x = n; + } +} + +struct C +{ + int i; + alias t = T!i; + mixin M!i m; +} + +alias ct = C.t; +alias ctset = C.t.set; +alias cm = C.m; +alias cmset = C.m.set; + + +// adapted from http://thecybershadow.net/d/dconf2017/#/21 +struct S { string a, b, c; } + +static string printField(alias field)() +{ + S s = { a: "aa", b: "bb", c: "cc" }; + return __traits(child, s, field); +} + +void main() +{ + auto f = printField!(S.b)(); + assert(f == "bb"); + + A a; + __traits(child, a, ai) = 3; + assert(a.i == 3); + assert(__traits(child, a, ai) == 3); + __traits(child, a, afoo)(2); + assert(a.i == 2); + __traits(child, a, afoo)("hello"); + assert(a.i == 5); + __traits(child, a, abar)(6); + assert(a.i == 6); + __traits(child, a, abar_ulong)(7); + assert(a.i == 7); + __traits(child, a, abar_string)("hi"); + assert(a.i == 2); + + __traits(child, a, A.i) = 7; + assert(a.i == 7); + __traits(child, a, A.bar)(3); + assert(a.i == 3); + __traits(child, a, A.bar!ulong)(4); + assert(a.i == 4); + __traits(child, a, __traits(getMember, A, "i")) = 5; + assert(a.i == 5); + __traits(child, a, __traits(getOverloads, A, "bar", true)[1])("hi!"); + assert(a.i == 3); + + B b; + __traits(child, b.a, ai) = 2; + assert(b.a.i == 2); + __traits(child, __traits(child, b, ba), ai) = 3; + assert(b.a.i == 3); + + C c; + __traits(child, c, ct).set(3); + assert(c.i == 3); + __traits(child, c, ctset)(4); + assert(c.i == 4); + __traits(child, c, cm).set(5); + assert(c.i == 5); + __traits(child, c, cmset)(6); + assert(c.i == 6); +} diff --git a/gcc/testsuite/gdc.test/runnable/uda.d b/gcc/testsuite/gdc.test/runnable/uda.d index c1782c9..a01a5ca 100644 --- a/gcc/testsuite/gdc.test/runnable/uda.d +++ b/gcc/testsuite/gdc.test/runnable/uda.d @@ -1,3 +1,38 @@ +/* +EXTRA_FILES: imports/a9741.d +TEST_OUTPUT: +--- +tuple(3, 4, 7, (SSS)) +tuple(3, 4, 7, (SSS)) +7 +SSS +tuple("hello") +tuple('c') +tuple((FFF)) +tuple(10) +tuple(20) +tuple(30) +tuple((Test6)) +tuple(Test7(3, "foo")) +tuple((Test8!"foo")) +tuple((Test9!"foo")) +tuple(Test10(3)) +tuple(Test11(3)) +tuple(10) +tuple(20) +tuple() +tuple(40) +B9741 +tuple((A9741)) +tuple(1) +tuple(2) +--- + +RUN_OUTPUT: +--- +Success +--- +*/ import core.stdc.stdio; @@ -467,6 +502,193 @@ static assert(__traits(getAttributes, FileData11844.member)[0](new FileData11844 /************************************************/ +template AliasSeq(T...) +{ + alias AliasSeq = T; +} + +template ParameterUDA(size_t p_num, func...) +if (func.length == 1 && is(typeof(func[0]) PT == __parameters) && PT.length > p_num) +{ + static if (is(typeof(func[0]) PT == __parameters)) + { + template Get(size_t i) + { + static if (//!isFunctionPointer!func && !isDelegate!func + // Parameters without UDA may yield CT error. + /*&&*/ is(typeof(__traits(getAttributes, PT[i..i+1]))x)) + { + alias Get = AliasSeq!(__traits(getAttributes, PT[i..i+1])); + } + else + { + alias Get = AliasSeq!(); + } + } + } + else + { + static assert(0, func[0].stringof ~ "is not a function"); + + // Define dummy entities to avoid pointless errors + template Get(size_t i) { alias Get = AliasSeq!(); } + alias PT = AliasSeq!(); + } + + alias ParameterUDA = Get!p_num; +} + +void test13x(@(10) int a, @(20) int, @(30) @(40) int[] arr...) {} + +void test13() +{ + static assert([ParameterUDA!(0, test13x)] == [10]); + static assert([ParameterUDA!(1, test13x)] == [20]); + static assert([ParameterUDA!(2, test13x)] == [30, 40]); +} + +template Test13t(F) +{ + static assert(!__traits(compiles, ParameterUDA!(0, F))); + static assert(!__traits(compiles, ParameterUDA!(1, F))); + static assert(!__traits(compiles, ParameterUDA!(2, F))); + enum Test13t = true; +} + +alias test13t = Test13t!(typeof(test13x)); + +enum Test14UDA1; + +struct Test14UDA2 +{ + string str; +} + +Test14UDA2 test14uda3(string name) +{ + return Test14UDA2(name); +} + +struct Test14UDA4(string v) +{ +} + +void test14x(@Test14UDA1 int, @Test14UDA2("1") int, @test14uda3("2") int, @Test14UDA4!"3" int) {} +void test14() +{ + static assert(is(ParameterUDA!(0, test14x)[0] == Test14UDA1)); + static assert(ParameterUDA!(1, test14x)[0] == Test14UDA2("1")); + static assert(ParameterUDA!(2, test14x)[0] == test14uda3("2")); + static assert(is(ParameterUDA!(3, test14x)[0] == Test14UDA4!"3")); +} + +void test15x(@(20) void delegate(int) @safe dg) +{ + static assert([__traits(getAttributes, dg)] == [20]); + static assert(is(typeof(dg) == void delegate(int) @safe)); +} + +template MinimalFunctionTypeOf(func...) +if (func.length == 1) +{ + static if (is(func[0] T) || is(typeof(func[0]) T) && is(T Fdlg == delegate)) + alias MinimalFunctionTypeOf = Fdlg; // HIT: delegate + else + static assert(0); +} + +template Parameters(func...) +if (func.length == 1) +{ + static if (is(MinimalFunctionTypeOf!func P == function)) + alias Parameters = P; + else + static assert(0, "argument has no parameters"); +} + +void test15y(@(20) void delegate(@Test14UDA2("2") @("test15yUDA") int) @safe dg) +{ + static assert([__traits(getAttributes, dg)] == [20]); + static assert(is(typeof(dg) == void delegate(int) @safe)); + auto foo = (@("myUDA") int x){ + static assert([__traits(getAttributes, x)] == ["myUDA"]); + }; + static assert(__traits(getAttributes, Parameters!dg)[0] == Test14UDA2("2")); + static assert(__traits(getAttributes, Parameters!dg)[1] == "test15yUDA"); +} + +void test15z() +{ + test15y((@(15) @(16) int x){ + static assert([__traits(getAttributes, x)] == [15, 16]); + }); +} + +void test16x(A)(@(22) A a) +{ + static assert([__traits(getAttributes, a)] == [22]); +} + +void test16() +{ + static assert([ParameterUDA!(0, test16x!int)] == [22]); +} + +void test17() +{ + void test17x(A)(@(23) A a) + { + static assert([__traits(getAttributes, a)] == [23]); + } + static assert([ParameterUDA!(0, test17x!int)] == [23]); +} + +void test18() +{ + void test18a(@(Tuple!(18, "a")) int a) + { + static assert(__traits(getAttributes, a) == Tuple!(18, "a")); + } + void test18b(@Tuple!(18, "b") int a) + { + static assert(__traits(getAttributes, a) == Tuple!(18, "b")); + } + + static assert(ParameterUDA!(0, test18a) == Tuple!(18, "a")); + static assert(ParameterUDA!(0, test18b) == Tuple!(18, "b")); +} + +// Lambdas with parentheses: +void test19() +{ + // lambdas without parentheses + alias test19a = @(3) b => 1 + 2; + alias test19b = @(3) @(4) b => 1 + 2; + + alias test19c = (@(3) c, @(5) d) => 1 + 2; + alias test19d = (@(3) @(4) c, @(5) d) => 1 + 2; + auto test19e = (@(3) int c, @(5) int d) => 1 + 2; + + // still allow alias function declarations + alias FuncType = @safe void function(); + alias FuncType2 = @safe nothrow void function(); + alias FuncType3 = nothrow void function(); + alias FuncType4 = nothrow @safe void function(); +} + +void test20() +{ + // Using a delegate with inferred parameter type + void test20a(int delegate(int) t){ t(1); } + test20a((@(19) a) { + static assert([__traits(getAttributes, a)] == [19]); + return a + 2; + }); +} + +/************************************************/ + + int main() { test1(); @@ -482,6 +704,13 @@ int main() test11(); test12(); test9178(); + test13(); + test14(); + test16(); + test17(); + test18(); + test19(); + test20(); printf("Success\n"); return 0; diff --git a/gcc/testsuite/gdc.test/runnable/xtest46.d b/gcc/testsuite/gdc.test/runnable/xtest46.d index 8cba4ed..bf19f57 100644 --- a/gcc/testsuite/gdc.test/runnable/xtest46.d +++ b/gcc/testsuite/gdc.test/runnable/xtest46.d @@ -1,5 +1,37 @@ // RUNNABLE_PHOBOS_TEST // PERMUTE_ARGS: -unittest -O -release -inline -fPIC -g +/* TEST_OUTPUT: +--- +Boo!double +Boo!int +true +int +!! immutable(int)[] +int(int i, long j = 7L) +long +C10390(C10390(C10390(<recursion>))) +tuple(height) +tuple(get, get) +tuple(clear) +tuple(draw, draw) +runnable/xtest46.d(149): Deprecation: `opDot` is deprecated. Use `alias this` +runnable/xtest46.d(151): Deprecation: `opDot` is deprecated. Use `alias this` +runnable/xtest46.d(152): Deprecation: `opDot` is deprecated. Use `alias this` +runnable/xtest46.d(154): Deprecation: `opDot` is deprecated. Use `alias this` +runnable/xtest46.d(181): Deprecation: `opDot` is deprecated. Use `alias this` +runnable/xtest46.d(183): Deprecation: `opDot` is deprecated. Use `alias this` +runnable/xtest46.d(184): Deprecation: `opDot` is deprecated. Use `alias this` +runnable/xtest46.d(186): Deprecation: `opDot` is deprecated. Use `alias this` +const(int) +string[] +double[] +double[] +{} +tuple("m") +true +TFunction1: extern (C) void function() +--- +*/ import std.stdio; import core.stdc.stdio; diff --git a/gcc/testsuite/gdc.test/runnable_cxx/cppa.d b/gcc/testsuite/gdc.test/runnable_cxx/cppa.d index b9b4832..cb576ba 100644 --- a/gcc/testsuite/gdc.test/runnable_cxx/cppa.d +++ b/gcc/testsuite/gdc.test/runnable_cxx/cppa.d @@ -571,18 +571,20 @@ void test13289() assert(f13289_cpp_test()); } +version(Posix) +{ + enum __c_wchar_t : dchar; +} +else version(Windows) +{ + enum __c_wchar_t : wchar; +} +alias wchar_t = __c_wchar_t; extern(C++) { bool f13289_cpp_test(); - version(Posix) - { - dchar f13289_cpp_wchar_t(dchar); - } - else version(Windows) - { - wchar f13289_cpp_wchar_t(wchar); - } + wchar_t f13289_cpp_wchar_t(wchar_t); wchar f13289_d_wchar(wchar ch) { @@ -606,6 +608,17 @@ extern(C++) return ch; } } + wchar_t f13289_d_wchar_t(wchar_t ch) + { + if (ch <= 'z' && ch >= 'a') + { + return cast(wchar_t)(ch - ('a' - 'A')); + } + else + { + return ch; + } + } } /****************************************/ diff --git a/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp index 587145c..823c660 100644 --- a/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp +++ b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp @@ -412,8 +412,12 @@ wchar_t f13289_d_wchar(wchar_t ch); unsigned int f13289_d_dchar(unsigned int ch); #endif +wchar_t f13289_d_wchar_t(wchar_t ch); + bool f13289_cpp_test() { + if (!(f13289_d_wchar_t(L'e') == L'E')) return false; + if (!(f13289_d_wchar_t(L'F') == L'F')) return false; #if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun || __NetBSD__ if (!(f13289_d_wchar((unsigned short)'c') == (unsigned short)'C')) return false; if (!(f13289_d_wchar((unsigned short)'D') == (unsigned short)'D')) return false; diff --git a/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp new file mode 100644 index 0000000..076777a --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp @@ -0,0 +1,82 @@ +#include <assert.h> +#include <complex.h> + +// Use custom types for inspecting parts instead of including tgmath.h +union cfloat_t { _Complex float z; struct { float re; float im; }; }; +union cdouble_t { _Complex double z; struct { double re; double im; }; }; +union creal_t { _Complex long double z; struct { long double re; long double im; }; }; + +// extern(C) tests +extern "C" _Complex float ccomplexf() { return 2.0f+I; } +extern "C" _Complex double ccomplex() { return 2.0+I; } +extern "C" _Complex long double ccomplexl() { return 2.0L+I; } +extern "C" void ccomplexf2(_Complex float c) { cfloat_t z = {c}; assert(z.re == 2 && z.im == 1); } +extern "C" void ccomplex2(_Complex double c) { cdouble_t z = {c}; assert(z.re == 2 && z.im == 1); } +extern "C" void ccomplexl2(_Complex long double c) { creal_t z = {c}; assert(z.re == 2 && z.im == 1); } + +// extern(C++) tests +_Complex float cpcomplexf() { return 2.0f+I; } +_Complex double cpcomplex() { return 2.0+I; } +_Complex long double cpcomplexl() { return 2.0L+I; } +void cpcomplexf(_Complex float c) { cfloat_t z = {c}; assert(z.re == 2 && z.im == 1); } +void cpcomplex(_Complex double c) { cdouble_t z = {c}; assert(z.re == 2 && z.im == 1); } +void cpcomplexl(_Complex long double c) { creal_t z = {c}; assert(z.re == 2 && z.im == 1); } + +// Struct tests +struct wrap_complexf { _Complex float c; }; +struct wrap_complex { _Complex double c; }; +struct wrap_complexl { _Complex long double c; }; + +wrap_complexf wcomplexf() +{ + wrap_complexf s; + s.c = 2.0f+I; + return s; +} + +wrap_complex wcomplex() +{ + wrap_complex s; + s.c = 2.0+I; + return s; +} + +wrap_complexl wcomplexl() +{ + wrap_complexl s; + s.c = 2.0L+I; + return s; +} + +void wcomplexf(wrap_complexf s) { cfloat_t z = {s.c}; assert(z.re == 2 && z.im == 1); } +void wcomplex(wrap_complex s) { cdouble_t z = {s.c}; assert(z.re == 2 && z.im == 1); } +void wcomplexl(wrap_complexl s) { creal_t z = {s.c}; assert(z.re == 2 && z.im == 1); } + +struct soft_complexf { float re; float im; }; +struct soft_complex { double re; double im; }; +struct soft_complexl { long double re; long double im; }; + +soft_complexf scomplexf() +{ + soft_complexf s; + s.re = 2.0f; s.im = 1.0f; + return s; +} + +soft_complex scomplex() +{ + soft_complex s; + s.re = 2.0; s.im = 1.0; + return s; +} + +soft_complexl scomplexl() +{ + soft_complexl s; + s.re = 2.0L; s.im = 1.0L; + return s; +} + +void scomplexf(soft_complexf s) { assert(s.re == 2 && s.im == 1); } +void scomplex(soft_complex s) { assert(s.re == 2 && s.im == 1); } +void scomplexl(soft_complexl s) { assert(s.re == 2 && s.im == 1); } diff --git a/gcc/testsuite/gdc.test/runnable_cxx/runnable_cxx.exp b/gcc/testsuite/gdc.test/runnable_cxx/runnable_cxx.exp index a37376a..ecb8c3e 100644 --- a/gcc/testsuite/gdc.test/runnable_cxx/runnable_cxx.exp +++ b/gcc/testsuite/gdc.test/runnable_cxx/runnable_cxx.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2020 Free Software Foundation, Inc. +# Copyright (C) 2012-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/gdc.test/runnable_cxx/test21515.d b/gcc/testsuite/gdc.test/runnable_cxx/test21515.d new file mode 100644 index 0000000..cc44207 --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable_cxx/test21515.d @@ -0,0 +1,104 @@ +// https://issues.dlang.org/show_bug.cgi?id=21515 +// EXTRA_CPP_SOURCES: test21515.cpp +// DISABLED: win32 win64 + +// ABI layout of native complex +struct _Complex(T) { T re; T im; } + +// Special enum definitions. +version (Posix) +{ + align(float.alignof) enum __c_complex_float : _Complex!float; + align(double.alignof) enum __c_complex_double : _Complex!double; + align(real.alignof) enum __c_complex_real : _Complex!real; +} +else +{ + align(float.sizeof * 2) enum __c_complex_float : _Complex!float; + align(double.sizeof * 2) enum __c_complex_double : _Complex!double; + align(real.alignof) enum __c_complex_real : _Complex!real; +} +alias complex_float = __c_complex_float; +alias complex_double = __c_complex_double; +alias complex_real = __c_complex_real; + +extern(C) complex_float ccomplexf(); +extern(C) complex_double ccomplex(); +extern(C) complex_real ccomplexl(); +extern(C) void ccomplexf2(complex_float c); +extern(C) void ccomplex2(complex_double c); +extern(C) void ccomplexl2(complex_real c); + +extern(C++) complex_float cpcomplexf(); +extern(C++) complex_double cpcomplex(); +extern(C++) complex_real cpcomplexl(); +extern(C++) void cpcomplexf(complex_float c); +extern(C++) void cpcomplex(complex_double c); +extern(C++) void cpcomplexl(complex_real c); + +struct wrap_complexf { complex_float c; alias c this; }; +struct wrap_complex { complex_double c; alias c this; }; +struct wrap_complexl { complex_real c; alias c this; }; + +extern(C++) wrap_complexf wcomplexf(); +extern(C++) wrap_complex wcomplex(); +extern(C++) wrap_complexl wcomplexl(); +extern(C++) void wcomplexf(wrap_complexf c); +extern(C++) void wcomplex(wrap_complex c); +extern(C++) void wcomplexl(wrap_complexl c); + +struct soft_complexf { float re; float im; }; +struct soft_complex { double re; double im; }; +struct soft_complexl { real re; real im; }; + +extern(C++) soft_complexf scomplexf(); +extern(C++) soft_complex scomplex(); +extern(C++) soft_complexl scomplexl(); +extern(C++) void scomplexf(soft_complexf c); +extern(C++) void scomplex(soft_complex c); +extern(C++) void scomplexl(soft_complexl c); + +int main() +{ + auto a1 = ccomplexf(); + auto b1 = ccomplex(); + auto c1 = ccomplexl(); + assert(a1.re == 2 && a1.im == 1); + assert(b1.re == 2 && b1.im == 1); + assert(c1.re == 2 && c1.im == 1); + ccomplexf2(a1); + ccomplex2(b1); + ccomplexl2(c1); + + auto a2 = cpcomplexf(); + auto b2 = cpcomplex(); + auto c2 = cpcomplexl(); + assert(a2.re == 2 && a2.im == 1); + assert(b2.re == 2 && b2.im == 1); + assert(c2.re == 2 && c2.im == 1); + cpcomplexf(a2); + cpcomplex(b2); + cpcomplexl(c2); + + auto a3 = wcomplexf(); + auto b3 = wcomplex(); + auto c3 = wcomplexl(); + assert(a3.re == 2 && a3.im == 1); + assert(b3.re == 2 && b3.im == 1); + assert(c3.re == 2 && c3.im == 1); + wcomplexf(a3); + wcomplex(b3); + wcomplexl(c3); + + auto a4 = scomplexf(); + auto b4 = scomplex(); + auto c4 = scomplexl(); + assert(a4.re == 2 && a4.im == 1); + assert(b4.re == 2 && b4.im == 1); + assert(c4.re == 2 && c4.im == 1); + scomplexf(a4); + scomplex(b4); + scomplexl(c4); + + return 0; +} |