D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1405 - Stack overflow when getting type info string of an invariant array
Summary: Stack overflow when getting type info string of an invariant array
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-08 07:41 UTC by Max Samukha
Modified: 2015-06-09 01:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Max Samukha 2007-08-08 07:41:02 UTC
invariant char[][] a = ["a", "b", "c"];

void main()
{
    auto s = typeid(typeof(a)).toString;
}

Error: Stack Overflow
Comment 1 Stewart Gordon 2007-10-21 12:07:35 UTC
Seems to work DMD 2.006.  But the result doesn't seem right.  Adding a write statement gives:

invariant invariant char[][]
Comment 2 Max Samukha 2009-10-21 00:52:16 UTC
dmd 2.035 outputs immutable(immutable(immutable(char)[])[]) which seems to be correct
Comment 3 Stewart Gordon 2009-10-21 01:20:20 UTC
(In reply to comment #2)
> dmd 2.035 outputs immutable(immutable(immutable(char)[])[]) which seems to be
> correct

Technically yes, though it ought to collapse the redundant immutables.

immutable(char[][])
Comment 4 Max Samukha 2009-10-21 01:43:47 UTC
Probably, yes. On the other hand, the non-normalized string can be easily parsed as immutable reference to immutable array of immutable strings. Anyway, it is not a bug.