summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
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 /source/slang/slang-check-decl.cpp
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 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 5ee8ba3ef..34143ad75 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -12412,7 +12412,7 @@ bool SemanticsDeclAttributesVisitor::_synthesizeCtorSignature(StructDecl* struct
// any constructors. see:
// https://github.com/shader-slang/slang/blob/master/docs/proposals/004-initialization.md#inheritance-initialization
if (_hasExplicitConstructor(structDecl, true))
- return false;
+ return true;
// synthesize the signature first.
// The constructor's visibility level is the same as the struct itself.