[Bug d/21354] New: can't index a dynamic array

andrew at ugh dot net.au sourceware-bugzilla@sourceware.org
Wed Apr 5 16:21:00 GMT 2017


            Bug ID: 21354
           Summary: can't index a dynamic array
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: d
          Assignee: unassigned at sourceware dot org
          Reporter: andrew at ugh dot net.au
  Target Milestone: ---

With a declaration like:

char[] string = "hello";

I can print it:

(gdb) p string
$1 = "hello"

But can't access individual elements:

(gdb) p string[0]
Invalid binary operation specified.

However using .ptr works:

(gdb) p string.ptr[0]
$2 = 104 'h'

I'm compiling using dmd v1.079.0 and using gdb as of

You are receiving this mail because:
You are on the CC list for the bug.

More information about the Gdb-prs mailing list