Appender example doesn't work with GDC. GDC bug?
BoraxMan
rotflol2 at hotmail.com
Sat Dec 28 08:25:16 UTC 2019
On Saturday, 28 December 2019 at 03:45:04 UTC, rikki cattermole
wrote:
> On 28/12/2019 4:30 PM, Adam D. Ruppe wrote:
>> On Saturday, 28 December 2019 at 03:08:48 UTC, BoraxMan wrote:
>>> For the line "Writeln(w[]);" GDC reports "error: no []
>>> operator overload for type Appender!string".
>>
>> I think that is just a broken example. Pretty sure it should
>> be `w.data` instead of `w[]`.
>
> This was added 5 months ago.
>
> The example is correct.
>
> https://github.com/dlang/phobos/commit/fbbdb721a5424748a485b5b8425e986fff4511a1
>
> FYI: the current version of gdc exists mostly to bootstrap
> future versions of gdc (because of rules surrounding gcc).
>
> You will get instances like this where your gdc build will be
> severely out of date. I would not recommend it for a new(-ish)
> user as of this moment.
Adams suggestion does work. Using w.data in place of w[]
provides the expected result.
The problem is that GDC is part of GCC now, and part of the
Fedora installation I'm using. I take it then if I am to start a
new project where I may end up providing binaries, I should
eschew using the GDC compiler and use LDC instead? This kind of
consideration is not an issue when using C or C++ (at least in
Linux). By default the choice is correct.
More information about the D.gnu
mailing list