-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test cases for CXX ambiguities (#682)
* Add test case for function pointer vs type cast ambiguity * Add test case MemberCallExpression vs CallExpression ambiguity * Update README.md Co-authored-by: Christian Banse <[email protected]>
- Loading branch information
Showing
4 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
void foo(int i) { | ||
} | ||
|
||
struct S { | ||
int a; | ||
} typedef s_t; | ||
|
||
typedef s_t* s_t_p; | ||
|
||
int main() { | ||
void (*ptr)(int) = &foo; | ||
|
||
// this is a function call | ||
(*ptr)(1); | ||
(ptr)(2); | ||
|
||
// this is a type case | ||
(int)(3); | ||
(s_t_p)(4); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
struct A { | ||
void foo(int i) { | ||
} | ||
}; | ||
|
||
struct B { | ||
void (*bar)(int); | ||
}; | ||
|
||
void bar(int i) { | ||
} | ||
|
||
int main() { | ||
A a; | ||
B b; | ||
b.bar = &bar; | ||
|
||
// foo is a method | ||
(a.foo)(1); | ||
a.foo(2); | ||
|
||
// bar is a function | ||
(b.bar)(3); | ||
(*b.bar)(3); | ||
|
||
return 0; | ||
} |