Issue 6572 - Deprecate typedef
Summary: Deprecate typedef
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: accepts-invalid, patch
Depends on:
Blocks:
 
Reported: 2011-08-29 08:48 UTC by yebblies
Modified: 2011-11-19 20:21 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description yebblies 2011-08-29 08:48:24 UTC
typedef needs to issue a deprecation error when used in D2.
Comment 2 Trass3r 2011-08-29 09:31:22 UTC
Shouldn't we provide a complete library based typedef first?
http://d.puremagic.com/issues/show_bug.cgi?id=5467
Comment 3 Iain Buclaw 2011-08-29 10:01:12 UTC
*sadface*

I think it is better to catch this in the parser stage, rather than semantic.


--- Dsymbols *Parser::parseDeclarations ---
             if (tok == TOKtypedef)
+            {
+                if (!global.params.useDeprecated)
+                    error("typedef is deprecated, use alias");
                 v = new TypedefDeclaration(loc, ident, t, init);
+            }


Regards
Iain
Comment 4 yebblies 2011-08-29 19:42:31 UTC
(In reply to comment #2)
> Shouldn't we provide a complete library based typedef first?
> http://d.puremagic.com/issues/show_bug.cgi?id=5467

Maybe, probably.

(In reply to comment #3)
> *sadface*
> 
> I think it is better to catch this in the parser stage, rather than semantic.
> 
> 
> --- Dsymbols *Parser::parseDeclarations ---
>              if (tok == TOKtypedef)
> +            {
> +                if (!global.params.useDeprecated)
> +                    error("typedef is deprecated, use alias");
>                  v = new TypedefDeclaration(loc, ident, t, init);
> +            }
> 
> 
> Regards
> Iain

Wouldn't this prevent using typedef even inside version(none) etc blocks?  Is that something we want?