D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3684 - Stack overflow on wrong template instantiation syntax with typeof
Summary: Stack overflow on wrong template instantiation syntax with typeof
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Linux
: P2 normal
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2010-01-07 03:17 UTC by Lars T. Kyllingstad
Modified: 2015-06-09 01:27 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 Lars T. Kyllingstad 2010-01-07 03:17:05 UTC
The following (incorrect) code causes DMD to segfault on compilation:

  template Foo(T) if (is(T == int))
  {
      enum bool Foo = true;
  }

  template Foo(T) if (!is(T == int))
  {
      enum bool Foo = Foo(typeof(int.min));
  }

  static assert (Foo!double);

In the second template, note the following two things which are BOTH required to reproduce the bug:

 1) The ! is missing from the template instantiation.
 2) The template parameter is typeof(int.min) instead of just int.
Comment 1 Don 2010-04-09 05:59:47 UTC
Fixed DMD2.043.