From 9ec6b91686b651d959fd9ffbec283845bd725dd6 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Wed, 5 Feb 2025 12:37:03 -0600 Subject: Feature/initialize list side branch (#6058) * SP004: implement initialize list translation to ctor - We synthesize a member-wise constructor for each struct follow the rules described in SP004. - Add logic to translate the initialize list to constructor invoke - Add cuda-host decoration for the synthesized constructor - Remove the default constructor when we have a valid member init constructor - Disable -zero-initialize option, will re-implement it in followup (#6109). - Fix the overload lookup issue When creating invoke expression for ctor, we need to call ResolveInvoke() to find us the best candidates, however the existing lookup logic could find us the base constructor for child struct, we should eliminate this case by providing the LookupOptions::IgnoreInheritance to lookup, this requires us to create a subcontext on SemanticsVisitor to indicate that we only want to use this option on looking the constructor. - Do not implicit initialize a struct that doesn't have explicit default constructor. Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- .../variable-redeclaration.slang.expected | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/diagnostics/variable-redeclaration.slang.expected') diff --git a/tests/diagnostics/variable-redeclaration.slang.expected b/tests/diagnostics/variable-redeclaration.slang.expected index 1998c13c8..842038180 100644 --- a/tests/diagnostics/variable-redeclaration.slang.expected +++ b/tests/diagnostics/variable-redeclaration.slang.expected @@ -30,6 +30,30 @@ tests/diagnostics/variable-redeclaration.slang(21): error 30200: declaration of tests/diagnostics/variable-redeclaration.slang(20): note: see previous declaration of 'y' int y = x; ^ +tests/diagnostics/variable-redeclaration.slang(41): error 30200: declaration of 'f' conflicts with existing declaration +struct S + ^ +tests/diagnostics/variable-redeclaration.slang(41): note: see previous declaration of 'f' +struct S + ^ +tests/diagnostics/variable-redeclaration.slang(43): error 39999: ambiguous reference to 'f' + int f; + ^ +tests/diagnostics/variable-redeclaration.slang(44): note 39999: candidate: float S.f + float f; + ^ +tests/diagnostics/variable-redeclaration.slang(43): note 39999: candidate: int S.f + int f; + ^ +tests/diagnostics/variable-redeclaration.slang(44): error 39999: ambiguous reference to 'f' + float f; + ^ +tests/diagnostics/variable-redeclaration.slang(44): note 39999: candidate: float S.f + float f; + ^ +tests/diagnostics/variable-redeclaration.slang(43): note 39999: candidate: int S.f + int f; + ^ tests/diagnostics/variable-redeclaration.slang(53): error 39999: ambiguous reference to 'size' return size; ^~~~ -- cgit v1.2.3