Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

[Repost] Issue 8220 - invalid function call not detected during semantic analysis #1007

Merged
merged 1 commit into from about 1 year ago

5 participants

Hara Kenji Don Clugston Andrej Mitrovic H. S. Teoh Walter Bright
Hara Kenji
Collaborator
9rnsr commented June 15, 2012

http://d.puremagic.com/issues/show_bug.cgi?id=8220

This pull is identical to #1000. @WalterBright reverted #1000, because of the breaking of test case that he has, but I think it is genuinely invalid code (my comment).

Don Clugston
Collaborator

I agree with you. I have written code like Walter's example in the past, and I later rewrote it because I decided it was wrong. int + int isn't valid, and typeof(int + int) shouldn't be, either. It's easy enough to add .init to every type to turn those into valid expressions. It's not like it's a silent breakage.

But only Walter can merge this.

Andrej Mitrovic
Collaborator

LGTM. @WalterBright please merge this before any more people start assuming that Type+Type is meaningful (6 months and counting!). AFAIK the specs never mention this as valid code, but you've said you told some people it does work. Couldn't you tell them about .init?

Walter Bright WalterBright merged commit 3644943 into from March 06, 2013
Walter Bright WalterBright closed this March 06, 2013
H. S. Teoh

This pull introduced a regression:

http://d.puremagic.com/issues/show_bug.cgi?id=9659

Deleted user Unknown referenced this pull request from a commit December 24, 2013
Commit has since been removed from the repository and is no longer available.
Deleted user Unknown referenced this pull request from a commit December 25, 2013
Commit has since been removed from the repository and is no longer available.
Deleted user Unknown referenced this pull request from a commit December 25, 2013
Commit has since been removed from the repository and is no longer available.
Deleted user Unknown referenced this pull request from a commit December 25, 2013
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

Showing 1 unique commit by 1 author.

Jul 23, 2012
fix Issue 8220 - invalid function call not detected during semantic a…
…nalysis
d56194c
This page is out of date. Refresh to see the latest.
3  src/expression.c
@@ -723,6 +723,9 @@ void preFunctionParameters(Loc loc, Scope *sc, Expressions *exps)
723 723
 #endif
724 724
             (*exps)[i] =  arg;
725 725
 
  726
+            if (arg->op == TOKtype)
  727
+                arg->error("%s is not an expression", arg->toChars());
  728
+
726 729
             //arg->rvalue();
727 730
 #if 0
728 731
             if (arg->type->ty == Tfunction)
6  test/runnable/xtest46.d
@@ -5137,6 +5137,12 @@ void test8064()
5137 5137
 }
5138 5138
 
5139 5139
 /***************************************************/
  5140
+// 8220
  5141
+
  5142
+void foo8220(int){}
  5143
+static assert(!__traits(compiles, foo8220(typeof(0)))); // fail
  5144
+
  5145
+/***************************************************/
5140 5146
 
5141 5147
 void func8105(in ref int x) { }
5142 5148
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.