-
Notifications
You must be signed in to change notification settings - Fork 0
Emit error for user-defined conversion operators in HLSL #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
21d7684
2ac173b
744ec43
ce85b5c
ca5ca4f
6247898
2fcaf36
6ea7cf1
d013457
b87d15d
9b0463b
67a8e24
745a694
cdbd4e6
bb168c9
2e477af
ad52cbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // RUN: %dxc -Tlib_6_3 -verify -HV 2021 %s | ||
|
|
||
| // This test verifies that dxcompiler generates an error when defining | ||
| // a conversion operator (cast operator), which is not supported in HLSL. | ||
|
|
||
| struct MyStruct { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be a test for the template-dependent case?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a template-dependent test case ( |
||
| float4 f; | ||
|
|
||
| // expected-error@+1 {{conversion operator is not supported in HLSL}} | ||
| operator float4() { | ||
| return 42; | ||
| } | ||
| }; | ||
|
|
||
| struct AnotherStruct { | ||
| int x; | ||
|
|
||
| // expected-error@+1 {{conversion operator is not supported in HLSL}} | ||
| operator int() { | ||
| return x; | ||
| } | ||
|
|
||
| // expected-error@+1 {{conversion operator is not supported in HLSL}} | ||
| operator bool() { | ||
| return x != 0; | ||
| } | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.