dmd/compiler/test/fail_compilation/ufcs.d
Dennis d5db322fce
Merge stable (#21048)
* bump VERSION to v2.110.0

* purge changelog

* bump VERSION to v2.111.0-beta.1

* Accept __rvalue attribute on ref functions; which will force the result to be treated as __rvalue. (#20946)

This is essential to implement `move`, `forward`, etc.

* memoryerror.d: Fix AnySupported version condition (#20983)

* Fix #20982 - wrong line number in iasmgcc (#20993)

* Move genCfunc to cxxfrontend (#20992)

* druntime: Fix compilation of rt.cover on Android (#21015)

* Expose SourceLoc to C++ interface (#20980)

* [stable] C++ header fixes for declaration, expression, and typinf (#21016)

Seen either from compilation errors or missing symbols at link time.

* C++ headers: Add 3 Declaration bitfield setters/getters required by LDC

* druntime: Add module declaration to rt.invariant, to prevent conflicts with user-provided invariant.d (#21017)

* Fix #21020 - Indexing a *cast* AA yields no lvalue anymore (#21029)

* Add C++23 to CppStdRevision enum (#21043)

* Improve UFCS/property error message (#21046)

---------

Co-authored-by: Manu Evans <turkeyman@gmail.com>
Co-authored-by: Martin Kinkelin <kinke@users.noreply.github.com>
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
Co-authored-by: Martin Kinkelin <noone@nowhere.com>
2025-03-21 15:48:21 +01:00

43 lines
1.7 KiB
D

/*
TEST_OUTPUT:
---
fail_compilation/ufcs.d(31): Error: no property `regularF` for `s` of type `S`
fail_compilation/ufcs.d(31): the following error occured while looking for a UFCS match
fail_compilation/ufcs.d(31): Error: function `regularF` is not callable using argument types `(S)`
fail_compilation/ufcs.d(31): expected 0 argument(s), not 1
fail_compilation/ufcs.d(39): `ufcs.regularF()` declared here
fail_compilation/ufcs.d(32): Error: no property `templateF` for `s` of type `S`
fail_compilation/ufcs.d(32): the following error occured while looking for a UFCS match
fail_compilation/ufcs.d(32): Error: template `templateF` is not callable using argument types `!()(S)`
fail_compilation/ufcs.d(40): Candidate is: `templateF()()`
fail_compilation/ufcs.d(33): Error: no property `templateO` for `s` of type `S`
fail_compilation/ufcs.d(33): the following error occured while looking for a UFCS match
fail_compilation/ufcs.d(33): Error: none of the overloads of template `ufcs.templateO` are callable using argument types `!()(S)`
fail_compilation/ufcs.d(42): Candidates are: `templateO()(int x)`
fail_compilation/ufcs.d(43): `templateO()(float y)`
fail_compilation/ufcs.d(36): Error: no property `local` for `s` of type `ufcs.S`
fail_compilation/ufcs.d(35): cannot call function `local` with UFCS because it is not declared at module scope
fail_compilation/ufcs.d(26): struct `S` defined here
---
*/
struct S { }
void f()
{
S s;
s.regularF();
s.templateF();
s.templateO();
void local(S) {}
s.local();
}
void regularF();
void templateF()();
void templateO()(int x);
void templateO()(float y);