www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7421] New: std.getopt does not work with shared strings

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: robert octarineparrot.com



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: -------
Feb 01 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7421


Robert Clipsham <robert octarineparrot.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|std.getopt does not work    |std.getopt does not work
                   |with shared strings         |with shared types



15:00:10 GMT ---
It appears getopt() doesn't work with any shared types.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7421


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com



PDT ---
See also issue 7526 and issue 7693

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