D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7682 - shared array type and "cast() is not an lvalue" error
Summary: shared array type and "cast() is not an lvalue" error
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: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2012-03-11 04:31 UTC by Kenji Hara
Modified: 2012-03-11 20:42 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 Kenji Hara 2012-03-11 04:31:40 UTC
Comment out of line A will suppress the error in line B.
----
template ConstOf(T)
{
    alias const(T) ConstOf;
}
void main()
{
    shared(ConstOf!(int[])) x;  // line A

    struct S3 { int[10] a; }
    shared(S3) sh3;
    shared(int[]) sh3sub = sh3.a[];
    assert(pointsTo(sh3sub));   // line B
        // Error: cast(shared(const(int[])))sh3sub is not an lvalue
}
bool pointsTo(S)(ref const S source) @trusted pure nothrow
{
    return true;
}
Comment 2 github-bugzilla 2012-03-11 19:32:59 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/0ac2cd091b51c158ecdad0c966e5ad910d2837c9
Merge pull request #797 from 9rnsr/fix7682

Issue 7682 - shared array type and "cast() is not an lvalue" error