Thread overview
[Issue 6032] wstring literals cannot be implicitly converted to const(wchar)*
Apr 21, 2015
Elie Morisse
Apr 22, 2015
yebblies
Dec 17, 2022
Iain Buclaw
Jul 14, 2023
Dlang Bot
Jul 14, 2023
Nick Treleaven
Jul 14, 2023
Dlang Bot
April 21, 2015
https://issues.dlang.org/show_bug.cgi?id=6032

Elie Morisse <syniurge@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |syniurge@gmail.com

--- Comment #3 from Elie Morisse <syniurge@gmail.com> ---
   const(char)* s = "foo"c; // fails too

Any rationale behind this?

--
April 22, 2015
https://issues.dlang.org/show_bug.cgi?id=6032

yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com

--- Comment #4 from yebblies <yebblies@gmail.com> ---
(In reply to Elie Morisse from comment #3)
>    const(char)* s = "foo"c; // fails too
> 
> Any rationale behind this?

Essentially that 'c' gives it an explicit type, so conversions are disabled.

--
April 22, 2015
https://issues.dlang.org/show_bug.cgi?id=6032

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com

--- Comment #5 from Steven Schveighoffer <schveiguy@yahoo.com> ---
So, should this be closed as WONTFIX?

I kind of agree with OP that a specifically typed string is not really any different than an ambiguous one. In fact, the compiler still adds the trailing null character even if you specify 'w'.

The one possibility I see that would be an issue is some type of overloading decision where you want to specifically choose the const(wchar)* version. Admittedly, this is very unlikely to occur in the wild.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=6032

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--
July 14, 2023
https://issues.dlang.org/show_bug.cgi?id=6032

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ntrel updated dlang/dlang.org pull request #3662 "[spec] Improve string literal docs" fixing this issue:

- Fix Issue 6032 - wstring literals cannot be implicitly converted to
const(wchar)*

  Until this works, it should not be documented.

https://github.com/dlang/dlang.org/pull/3662

--
July 14, 2023
https://issues.dlang.org/show_bug.cgi?id=6032

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #7 from Nick Treleaven <nick@geany.org> ---
Changed the pull not to close this issue.

--
July 14, 2023
https://issues.dlang.org/show_bug.cgi?id=6032

--- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dlang.org pull request #3662 "[spec] Improve string literal docs" was merged into master:

- 0ca0e63d81fc14b1610625693ee6aa9fd475f6c1 by Nick Treleaven:
  Document that StringPostfix disables implicit conversions

  Part of Issue 6032 - wstring literals cannot be implicitly converted to
const(wchar)*

https://github.com/dlang/dlang.org/pull/3662

--