-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Use identifier name without check the identifier exists will cause crash. Fixes #6426 --------- Co-authored-by: Tex Riddell <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> (cherry picked from commit 7581ff4)
- Loading branch information
1 parent
9c2b828
commit 11e1318
Showing
2 changed files
with
34 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// RUN: %dxc -Tps_6_0 -verify %s | ||
|
||
// expected-error@+1 {{overloading non-member 'operator==' is not allowed}} | ||
bool operator==(int lhs, int rhs) { | ||
return true; | ||
} | ||
|
||
struct A { | ||
float a; | ||
int b; | ||
}; | ||
|
||
// expected-error@+1 {{overloading non-member 'operator>' is not allowed}} | ||
bool operator>(A a0, A a1) { | ||
return a1.a > a0.a && a1.b > a0.b; | ||
} | ||
// expected-error@+1 {{overloading non-member 'operator==' is not allowed}} | ||
bool operator==(A a0, int i) { | ||
return a0.b == i; | ||
} | ||
// expected-error@+1 {{overloading non-member 'operator<' is not allowed}} | ||
bool operator<(A a0, float f) { | ||
return a0.a < f; | ||
} | ||
// expected-error@+1 {{overloading 'operator++' is not allowed}} | ||
A operator++(A a0) { | ||
a0.a++; | ||
a0.b++; | ||
return a0; | ||
} | ||
|
||
void main() {} |