-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding separate construct delegation tests
- Loading branch information
1 parent
49d8e2b
commit 1744146
Showing
3 changed files
with
46 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//TEST:SIMPLE(filecheck=CHK): -target spirv | ||
|
||
// Delegated constructors | ||
struct Impl | ||
{ | ||
float x; | ||
|
||
__init(float val) | ||
{ | ||
x = val; | ||
} | ||
|
||
__init() | ||
{ | ||
float val = 2.0; | ||
|
||
// Shouldn't trigger a warning here | ||
return Impl(val); | ||
} | ||
} | ||
|
||
// Calling a method from a constructor to initialize fields | ||
struct HitInfo | ||
{ | ||
float3 barycentrics; | ||
uint primitiveIndex; | ||
|
||
[[mutating]] void init(float2 hitBarycentrics, uint hitPrimitiveIndex) | ||
{ | ||
barycentrics = { 1.0 - hitBarycentrics.x - hitBarycentrics.y, hitBarycentrics.x, hitBarycentrics.y }; | ||
primitiveIndex = hitPrimitiveIndex; | ||
} | ||
|
||
__init(float2 hitBarycentrics, uint hitPrimitiveIndex) | ||
{ | ||
init(hitBarycentrics, hitPrimitiveIndex); | ||
} | ||
|
||
__init(BuiltInTriangleIntersectionAttributes attr) | ||
{ | ||
init(attr.barycentrics, PrimitiveIndex()); | ||
} | ||
} | ||
|
||
//CHK-NOT: warning 41020 | ||
//CHK-NOT: warning 41021 |
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