summaryrefslogtreecommitdiff
path: root/tests/language-feature/interfaces/default-construct-conformance.slang
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-03-06 22:38:28 -0600
committerGitHub <noreply@github.com>2025-03-06 20:38:28 -0800
commite1952dc8cf8f5b62d00ce114e353c5390cc6c37a (patch)
tree3c04706cb3c110fcf2f65f11eca8d37dcd42dcf1 /tests/language-feature/interfaces/default-construct-conformance.slang
parent9d7d943db47dd7805a710431cf7eedc0bec8ecc7 (diff)
Fix a bug in default ctor synthesizing (#6527)
* Fix a bug in default ctor synthesizing - This is fix for the implementation bug, when a struct has explicit ctor we should not synthesize the default ctor anymore. - When invoke the synthesized ctor converted from initializer list, we should check if the struct is a c-style type if it struct has no synthesized ctor. In this case we should report error because it's invalid to use initializer list here. - The only exception is the unsized array, we still have to fall back to use the legacy initializer list logic to initialize the unsized array until we formalize a proper solution. - update test.
Diffstat (limited to 'tests/language-feature/interfaces/default-construct-conformance.slang')
-rw-r--r--tests/language-feature/interfaces/default-construct-conformance.slang7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/language-feature/interfaces/default-construct-conformance.slang b/tests/language-feature/interfaces/default-construct-conformance.slang
index 4a6aed869..b68dc8a4c 100644
--- a/tests/language-feature/interfaces/default-construct-conformance.slang
+++ b/tests/language-feature/interfaces/default-construct-conformance.slang
@@ -33,6 +33,11 @@ struct TestAny : ITest
value = v;
}
+ __init()
+ {
+ value = 0;
+ }
+
uint getValue() { return value; }
}
@@ -183,4 +188,4 @@ void testMain(uint3 threadID: SV_DispatchThreadID)
}
expected[outputIdx++] = uint(-1);
-} \ No newline at end of file
+}