D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20626 - ICE when using typeof of unittest symbol without -unittest flag
Summary: ICE when using typeof of unittest symbol without -unittest flag
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code, pull
Depends on:
Blocks:
 
Reported: 2020-03-02 18:40 UTC by Mathias LANG
Modified: 2020-05-15 19:51 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 Mathias LANG 2020-03-02 18:40:21 UTC
```
unittest {}
pragma(msg, typeof(__unittest_L1_C1));
```

Compile with `dmd test.d` and you get a segv. Compile with `dmd -unittest test.d` and it works just fine.
Tested with DMD v2.090.1 & madteer as of 2020-03-03.
Found while working on https://github.com/dlang/dmd/pull/10834
Comment 1 moonlightsentinel 2020-03-02 20:53:26 UTC
Digger:

commit 081494aaf8251f37dc08960d40bfb159968ed729
Author: The Dlang Bot <code+dlang-bot@dawg.eu>
Date:   Fri Feb 2 00:16:54 2018 +0100

    dmd: Merge pull request #7761 from atilaneves/fix_18097

    https://github.com/dlang/dmd/pull/7761

    Fix issue 18097 - unittest symbol names can be used before semantic
    merged-on-behalf-of: Iain Buclaw <ibuclaw@gdcproject.org>
Comment 2 moonlightsentinel 2020-05-15 10:24:54 UTC
What should typeof(__unittest_L1_C1) return, the actual function type or _error_?
Comment 3 moonlightsentinel 2020-05-15 10:29:42 UTC
(In reply to moonlightsentinel from comment #2)
> What should typeof(__unittest_L1_C1) return, the actual function type or
> _error_?

Or void?
Comment 4 Dlang Bot 2020-05-15 11:03:46 UTC
@MoonlightSentinel created dlang/dmd pull request #11145 "Fix Issue 20626 - ICE when using typeof of unittest symbol without -u…" fixing this issue:

- Fix Issue 20626 - ICE when using typeof of unittest symbol without -unittest flag

https://github.com/dlang/dmd/pull/11145
Comment 5 Dlang Bot 2020-05-15 19:51:23 UTC
dlang/dmd pull request #11145 "Fix Issue 20626 - ICE when using typeof of unittest symbol without -u…" was merged into stable:

- 71ce029a48caf897c463df0513f713af88eb42ed by MoonlightSentinel:
  Fix Issue 20626 - ICE when using typeof of unittest symbol without -unittest flag

https://github.com/dlang/dmd/pull/11145