7793 – static assert( void_function() ) gives misleading error message

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7793 - static assert( void_function() ) gives misleading error message
Summary: static assert( void_function() ) gives misleading error message
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: diagnostic
Depends on:
Blocks:
Reported: 2012年03月29日 00:38 UTC by Don
Modified: 2015年06月09日 05:11 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2012年03月29日 00:38:57 UTC
void f(){}
static assert(f());
----
bug.d(10): Error: cannot evaluate f() at compile time
bug.d(10): while evaluating: static assert(f())
But actually f() was successfully evaluated at compile time!
Comment 1 Don 2012年03月29日 00:49:46 UTC
And it also applies to static if.
Comment 2 github-bugzilla 2012年06月22日 00:22:47 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/8a1f31f4b2307fc4dc3c068d928ab9e26ea0ae11
fix
Issue 7793 - static assert( void_function() ) gives misleading error message
Comment 3 github-bugzilla 2012年06月22日 00:22:47 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/3bfac1394e3d123aa487fd6a1ccf62b06ca8c9b1
fix
Issue 7793 - static assert( void_function() ) gives misleading error message
Comment 4 github-bugzilla 2012年06月22日 10:50:59 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/6610acf74883822609e165a470fbe6c812e03692
Fix regression introduced by issue 7793 fix.
In 3bfac13, inc is set to 2 instead of 0, which causes errors to go by unnoticed in some circumstances.
An alternative fix for 7793 would be to only skip invoking e->ctfeInterpret() if the type is not bool – I'm not sure why/if returning early is preferrable here.
https://github.com/D-Programming-Language/dmd/commit/7e501522c15ff03e4460e25cdba5c1ce2e85f445
Merge pull request #1024 from klickverbot/7793-fix
Fix regression introduced by issue 7793 fix.


AltStyle によって変換されたページ (->オリジナル) /