D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17446 - Static-assert passes/fails based on what follows
Summary: Static-assert passes/fails based on what follows
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-27 12:03 UTC by Dario Schiavon
Modified: 2022-11-18 15:24 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 Dario Schiavon 2017-05-27 12:03:12 UTC
import std.traits : isAssignable;

struct MyStruct
{
	static assert(isAssignable!MyStruct);
	// fails, but passes if the following line is removed
	
	static if (isAssignable!MyStruct) {}
}

The assertion fails (wrongly IMO), but passes if the following static-if is removed.

Using DMD32 v2.074.0 or LDC2 v1.1.1 (based on DMD v2.071.2).

See also https://issues.dlang.org/show_bug.cgi?id=17445
Comment 1 RazvanN 2022-11-18 15:24:59 UTC
I cannot reproduce this. The assert passes with and without the static if.

Closing as WORKSFORME.