Fix MSVC narrowing warnings in newer MSVC versions.

Bug: dawn:824
Change-Id: I4be68ab47e5aa846583240c1024e286d7ec2e115
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75073
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Corentin Wallez 2022-01-04 15:31:24 +00:00 committed by Tint LUCI CQ
parent 09c49b34d9
commit f09a23a3f7
2 changed files with 10 additions and 9 deletions

View File

@ -1565,7 +1565,7 @@ sem::Call* Resolver::TypeConstructor(
[&](const sem::Type* t, size_t i) -> const sem::Parameter* {
return builder_->create<sem::Parameter>(
nullptr, // declaration
i, // index
static_cast<uint32_t>(i), // index
t->UnwrapRef(), // type
ast::StorageClass::kNone, // storage_class
ast::Access::kUndefined); // access

View File

@ -155,14 +155,15 @@ const sem::Call* AppendVector(ProgramBuilder* b,
return expr->Declaration();
}));
auto* constructor_target = b->create<sem::TypeConstructor>(
packed_sem_ty,
utils::Transform(packed,
[&](const tint::sem::Expression* arg,
size_t i) -> const sem::Parameter* {
return b->create<sem::Parameter>(
nullptr, i, arg->Type()->UnwrapRef(),
ast::StorageClass::kNone, ast::Access::kUndefined);
}));
packed_sem_ty, utils::Transform(packed,
[&](const tint::sem::Expression* arg,
size_t i) -> const sem::Parameter* {
return b->create<sem::Parameter>(
nullptr, static_cast<uint32_t>(i),
arg->Type()->UnwrapRef(),
ast::StorageClass::kNone,
ast::Access::kUndefined);
}));
auto* constructor_sem = b->create<sem::Call>(
constructor_ast, constructor_target, packed, statement, sem::Constant{});
b->Sem().Add(constructor_ast, constructor_sem);