mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
Merge remote-tracking branch 'origin/stable'
Conflicts: compiler/src/dmd/declaration.h compiler/src/dmd/frontend.h compiler/src/dmd/globals.h compiler/src/dmd/typesem.d compiler/src/tests/cxxfrontend.cc compiler/test/fail_compilation/fail347.d
This commit is contained in:
commit
58d065f935
20 changed files with 197 additions and 67 deletions
77
compiler/test/compilable/imports/test21098_phobos.d
Normal file
77
compiler/test/compilable/imports/test21098_phobos.d
Normal file
|
@ -0,0 +1,77 @@
|
|||
struct Nullable(T)
|
||||
{
|
||||
static struct DontCallDestructorT
|
||||
{
|
||||
T payload;
|
||||
}
|
||||
|
||||
DontCallDestructorT _value;
|
||||
|
||||
string toString() const
|
||||
{
|
||||
Appender!string app;
|
||||
formatValueImpl(app, _value);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct Appender(A)
|
||||
{
|
||||
InPlaceAppender!A impl;
|
||||
}
|
||||
|
||||
struct InPlaceAppender(T)
|
||||
{
|
||||
static void toStringImpl(const T[] data)
|
||||
{
|
||||
string app;
|
||||
formatValue(app, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void formatValueImpl(Writer, T)(Writer, const(T)) {}
|
||||
|
||||
void formatValueImpl(Writer, T)(Writer w, T obj)
|
||||
if (is(T == U[], U))
|
||||
{
|
||||
formatValue(w, obj[0]);
|
||||
}
|
||||
|
||||
enum HasToStringResult
|
||||
{
|
||||
none,
|
||||
bla
|
||||
}
|
||||
|
||||
template hasToString(T)
|
||||
{
|
||||
static if (is(typeof(
|
||||
(T val) {
|
||||
val.toString(s);
|
||||
})))
|
||||
enum hasToString = HasToStringResult.bla;
|
||||
else
|
||||
enum hasToString = HasToStringResult.none;
|
||||
}
|
||||
|
||||
void formatValueImpl(Writer, T)(ref Writer w, T val)
|
||||
if (is(T == struct) || is(T == union))
|
||||
{
|
||||
static if (hasToString!T)
|
||||
int dummy;
|
||||
formatElement(w, val.tupleof);
|
||||
}
|
||||
|
||||
void formatElement(Writer, T)(Writer w, T val)
|
||||
{
|
||||
formatValueImpl(w, val);
|
||||
}
|
||||
|
||||
void formatValue(Writer, T)(Writer w, T val)
|
||||
{
|
||||
formatValueImpl(w, val);
|
||||
}
|
12
compiler/test/compilable/imports/test21098b.d
Normal file
12
compiler/test/compilable/imports/test21098b.d
Normal file
|
@ -0,0 +1,12 @@
|
|||
import imports.test21098_phobos : Appender, Nullable;
|
||||
|
||||
struct Type {
|
||||
Nullable!(Type[]) templateArgs;
|
||||
}
|
||||
|
||||
Type[] parseDeclarations() {
|
||||
Appender!(Type[]) members;
|
||||
return null;
|
||||
}
|
||||
|
||||
enum ast = parseDeclarations();
|
|
@ -1,4 +1,4 @@
|
|||
/* REQUIRED_ARGS: -wi
|
||||
/* REQUIRED_ARGS: -wi -verrors=simple
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
compilable/pragmapack.c(101): Warning: current pack attribute is default
|
||||
|
|
|
@ -19,12 +19,10 @@
|
|||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
|
||||
#ifndef __APPLE__ // /Applications/Xcode-14.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tgmath.h(39): Error: named parameter required before `...`
|
||||
#include <math.h>
|
||||
#ifndef _MSC_VER // C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_math.h(93): Error: reinterpretation through overlapped field `f` is not allowed in CTFE
|
||||
float x = NAN;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _MSC_VER // setjmp.h(51): Error: missing tag `identifier` after `struct
|
||||
#include <setjmp.h>
|
||||
|
|
4
compiler/test/compilable/test21098.d
Normal file
4
compiler/test/compilable/test21098.d
Normal file
|
@ -0,0 +1,4 @@
|
|||
// https://github.com/dlang/dmd/issues/21098
|
||||
|
||||
// EXTRA_FILES: imports/test21098b.d imports/test21098_phobos.d
|
||||
import imports.test21098b;
|
8
compiler/test/compilable/test21153.d
Normal file
8
compiler/test/compilable/test21153.d
Normal file
|
@ -0,0 +1,8 @@
|
|||
// https://github.com/dlang/dmd/issues/21153
|
||||
alias AliasSeq(TList...) = TList;
|
||||
class DataClass;
|
||||
void reduce(DataClass[] r)
|
||||
{
|
||||
alias Args = AliasSeq!(DataClass);
|
||||
Args result = r[0];
|
||||
}
|
11
compiler/test/compilable/test21179.d
Normal file
11
compiler/test/compilable/test21179.d
Normal file
|
@ -0,0 +1,11 @@
|
|||
// https://github.com/dlang/dmd/issues/21179
|
||||
|
||||
void bigEndianToNative(ubyte[2] a) {}
|
||||
|
||||
void main()
|
||||
{
|
||||
ubyte[] arr;
|
||||
const ubyte[2] bytes;
|
||||
bigEndianToNative(bytes);
|
||||
auto b = cast(const ubyte[2][]) arr;
|
||||
}
|
|
@ -1,22 +1,24 @@
|
|||
/*
|
||||
/*
|
||||
REQUIRED_ARGS: -verrors=context
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail_pretty_errors.d(27): Error: undefined identifier `a`
|
||||
fail_compilation/fail_pretty_errors.d(29): Error: undefined identifier `a`
|
||||
a = 1;
|
||||
^
|
||||
fail_compilation/fail_pretty_errors.d-mixin-32(32): Error: undefined identifier `b`
|
||||
fail_compilation/fail_pretty_errors.d(37): Error: cannot implicitly convert expression `5` of type `int` to `string`
|
||||
fail_compilation/fail_pretty_errors.d-mixin-34(34): Error: undefined identifier `b`
|
||||
b = 1;
|
||||
^
|
||||
fail_compilation/fail_pretty_errors.d(39): Error: cannot implicitly convert expression `5` of type `int` to `string`
|
||||
string x = 5;
|
||||
^
|
||||
fail_compilation/fail_pretty_errors.d(42): Error: mixin `fail_pretty_errors.testMixin2.mixinTemplate!()` error instantiating
|
||||
fail_compilation/fail_pretty_errors.d(44): Error: mixin `fail_pretty_errors.testMixin2.mixinTemplate!()` error instantiating
|
||||
mixin mixinTemplate;
|
||||
^
|
||||
fail_compilation/fail_pretty_errors.d(48): Error: invalid array operation `"" + ""` (possible missing [])
|
||||
fail_compilation/fail_pretty_errors.d(50): Error: invalid array operation `"" + ""` (possible missing [])
|
||||
auto x = ""+"";
|
||||
^
|
||||
fail_compilation/fail_pretty_errors.d(48): did you mean to concatenate (`"" ~ ""`) instead ?
|
||||
fail_compilation/fail_pretty_errors.d(51): Error: cannot implicitly convert expression `1111` of type `int` to `byte`
|
||||
fail_compilation/fail_pretty_errors.d(50): did you mean to concatenate (`"" ~ ""`) instead ?
|
||||
fail_compilation/fail_pretty_errors.d(53): Error: cannot implicitly convert expression `1111` of type `int` to `byte`
|
||||
byte ɑ = 1111;
|
||||
^
|
||||
---
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
// check dsymbolSemantic analysis of C files
|
||||
/* TEST_OUTPUT:
|
||||
REQUIRED_ARGS: -verrors=context
|
||||
---
|
||||
fail_compilation/failcstuff6.c(56): Error: enum member `failcstuff6.test_overflow.boom` initialization with `2147483647+1` causes overflow for type `int`
|
||||
boom,
|
||||
^
|
||||
---
|
||||
*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue