Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Cast T[] to integral type: deprecation -> error. #1755

Merged
merged 1 commit into from

3 participants

@ibuclaw
Collaborator

Having a look at: http://dlang.org/deprecate.html

I see that casting from T[] to an integral type became an error in 2.061. However it still produces the deprecation warning in the frontend before finally being rejected by the backend.

Deprecation: casting int[] to ulong is deprecated
Error: e2ir: cannot cast [1, 2] of type int[] to type ulong

This change makes it correctly error in the frontend, and probably puts the final nail in the coffin to make it error -> gone.

@leandro-lucarella-sociomantic

I think this is a duplicate of #1292 which for some reason got never merged... I was also the one how made the pull request to update the documentation, but only the documentation update got in.

Hope you have better luck!

@ibuclaw
Collaborator

Good to know! I thought I was just seeing a discrepancy between documentation + compiler.

@WalterBright WalterBright merged commit 0442749 into D-Programming-Language:master
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 16, 2013
  1. @ibuclaw
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/expression.c
View
5 src/expression.c
@@ -9195,7 +9195,10 @@ Expression *CastExp::semantic(Scope *sc)
}
if (tob->isintegral() && t1b->ty == Tarray)
- deprecation("casting %s to %s is deprecated", e1->type->toChars(), to->toChars());
+ {
+ error("cannot cast %s to integral type %s", e1->toChars(), to->toChars());
+ return new ErrorExp();
+ }
if (tob->ty == Tpointer && t1b->ty == Tdelegate)
deprecation("casting from %s to %s is deprecated", e1->type->toChars(), to->toChars());
Something went wrong with that request. Please try again.