Skip to content

Commit

Permalink
Bypass the issue shader-slang#4874 for now
Browse files Browse the repository at this point in the history
-Formatting
  • Loading branch information
kaizhangNV committed Jan 15, 2025
1 parent 67b2929 commit b424c58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion source/slang/slang-check-conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,11 @@ 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<ModuleDecl>(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.
Expand All @@ -839,7 +844,7 @@ bool SemanticsVisitor::_coerceInitializerList(
}

// Try to invoke the synthesized constructor if it exists
if (_invokeExprForSynthesizedCtor(toType, fromInitializerListExpr, outToExpr))
if (_invokeExprForSynthesizedCtor(toType, fromInitializerListExpr, outToExpr) && !isGlobalDecl)
{
return true;
}
Expand Down
8 changes: 4 additions & 4 deletions source/slang/slang-check-decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9247,8 +9247,7 @@ void SemanticsDeclBodyVisitor::synthesizeCtorBodyForBases(
invoke->arguments.insertRange(0, argumentList);

auto assign = m_astBuilder->create<AssignExpr>();
assign->left =
coerce(CoercionSite::Initializer, baseCtor->returnType.type, thisExpr);
assign->left = coerce(CoercionSite::Initializer, baseCtor->returnType.type, thisExpr);
assign->right = invoke;

auto stmt = m_astBuilder->create<ExpressionStmt>();
Expand Down Expand Up @@ -12243,8 +12242,9 @@ bool SemanticsDeclAttributesVisitor::_searchMembersWithHigherVisibility(
{
for (auto param : ctor->getParameters())
{
// Because the parameters in the ctor must have the higher or equal visibility than
// the ctor itself, we don't need to check the visibility level of the parameter.
// Because the parameters in the ctor must have the higher or equal visibility
// than the ctor itself, we don't need to check the visibility level of the
// parameter.
resultMembers.add(param);
}
}
Expand Down

0 comments on commit b424c58

Please sign in to comment.