http://d.puremagic.com/issues/show_bug.cgi?id=7421

           Summary: std.getopt does not work with shared strings
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: rob...@octarineparrot.com


--- Comment #0 from Robert Clipsham <rob...@octarineparrot.com> 2012-02-01 
20:55:01 GMT ---
When using the following:
----
import std.getopt;

shared string foo;

void main(string[] args)
{
    getopt(args, "foo", &foo);
}
----
Then using:

$ dmd test.d
$ ./test --foo=bar
std.conv.ConvException@/home/robert/.dvm/compilers/dmd-2.056/bin/../src/phobos/std/conv.d(1749):
Can't convert value `oo' of type string to type immutable(char)
----------------
./test(immutable(char) std.conv.toImpl!(immutable(char),
immutable(char)[]).toImpl(immutable(char)[])+0x43) [0x80671c3]
./test(immutable(char)
std.conv.to!(immutable(char)).to!(immutable(char)[]).to(immutable(char)[])+0xe)
[0x80670a2]
./test(void
std.getopt.handleOption!(shared(immutable(char)[])*).handleOption(immutable(char)[],
shared(immutable(char)[])*, ref immutable(char)[][], ref
std.getopt.configuration, bool)+0x393) [0x8066f13]
./test(void std.getopt.getoptImpl!(immutable(char)[],
shared(immutable(char)[])*).getoptImpl(ref immutable(char)[][], ref
std.getopt.configuration, immutable(char)[], shared(immutable(char)[])*)+0x90)
[0x8066b00]
./test(void std.getopt.getopt!(immutable(char)[],
shared(immutable(char)[])*).getopt(ref immutable(char)[][], immutable(char)[],
shared(immutable(char)[])*)+0x35) [0x8066a1d]
./test(_Dmain+0x1d) [0x80669e1]
./test(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x14)
[0x8069a90]
./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void
delegate())+0x1d) [0x8069735]
./test(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x37)
[0x8069ad7]
./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void
delegate())+0x1d) [0x8069735]
./test(main+0x94) [0x80696e4]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x60c113]
----------------

Removing the shared qualifier removes the issue. Tested with dmd 2.056 and
dmd-master on Linux x86-32.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to