diff --git a/source/slang/slang-check-conversion.cpp b/source/slang/slang-check-conversion.cpp index 3938af15e3..75e71b6302 100644 --- a/source/slang/slang-check-conversion.cpp +++ b/source/slang/slang-check-conversion.cpp @@ -843,11 +843,6 @@ bool SemanticsVisitor::_coerceInitializerList( !canCoerce(toType, fromInitializerListExpr->type, nullptr)) return _failedCoercion(toType, outToExpr, fromInitializerListExpr); - // TODO: See issue #4874, we cannot handle the case of calling a constructor with - // resource types at global scope. So we will still use the legacy initializer list - // for the global variable. - bool isGlobalDecl = (m_outerScope && as(m_outerScope->containerDecl)); - // Try to invoke the user-defined constructor if it exists. This call will // report error diagnostics if the used-defined constructor exists but does not // match the initialize list. @@ -857,7 +852,7 @@ bool SemanticsVisitor::_coerceInitializerList( } // Try to invoke the synthesized constructor if it exists - if (_invokeExprForSynthesizedCtor(toType, fromInitializerListExpr, outToExpr) && !isGlobalDecl) + if (_invokeExprForSynthesizedCtor(toType, fromInitializerListExpr, outToExpr)) { return true; } diff --git a/tests/compute/type-legalize-global-with-init.slang b/tests/compute/type-legalize-global-with-init.slang index 573ac98499..7316cad1d1 100644 --- a/tests/compute/type-legalize-global-with-init.slang +++ b/tests/compute/type-legalize-global-with-init.slang @@ -5,6 +5,7 @@ // resources. // //TEST(compute):COMPARE_COMPUTE: -shaderobj +//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj // //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer RWStructuredBuffer outputBuffer;