Add tests

This commit is contained in:
Nick Treleaven 2023-09-01 11:18:04 +01:00
parent a3a452fe35
commit 23ac807fe9
2 changed files with 18 additions and 0 deletions

View file

@ -79,6 +79,7 @@ class ErrorSinkNull : ErrorSink
/*****************************************
* Simplest implementation, just sends messages to stderr.
* See also: ErrorSinkCompiler.
*/
class ErrorSinkStderr : ErrorSink
{

View file

@ -0,0 +1,17 @@
/*
TEST_OUTPUT:
---
fail_compilation/match_func_ptr.d(13): Error: cannot match delegate literal to function pointer type `void function()`
fail_compilation/match_func_ptr.d(14): Error: cannot match function literal to delegate type `void delegate()`
fail_compilation/match_func_ptr.d(15): Error: cannot infer parameter types from `int function()`
fail_compilation/match_func_ptr.d(16): Error: cannot infer parameter types from `int delegate(int, int)`
---
*/
void main()
{
void function() f = delegate {};
void delegate() d = function {};
int function() f2 = i => 2;
int delegate(int, int) d2 = i => 2;
}