Bug 1885 – Syntax error for object identity test between invariant/mutable references
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2008-03-02T09:03:00Z
Last change time
2015-06-09T01:14:35Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
sludwig
Comments
Comment #0 by sludwig — 2008-03-02T09:03:17Z
Checking for object identity using 'a is b' causes a syntax error, if one of a and b is of type invariant(C) and the other one is typed C - although this should be allowed.
-----------------
class C {}
struct S {}
int main(){
invariant(S)* si;
S* sm;
// Works:
bool a = si is sm;
invariant(C) ci;
const(C) cm;
// Error: incompatible types for ((ci) is (cm)): 'invariant(C)' and 'bug_is.C'
bool b = ci is cm;
return 0;
}
-----------------