Remove null-deref in test

Dereferencing a nullptr is UB by spec, even if the method called is
non-virtual and no memory access to nullptr appears to actually occur.
For example:

error: 'this' pointer cannot be null in well-defined C++ code;
comparison may be assumed to always evaluate to true
[-Werror,-Wtautological-undefined-compare]

Bug: b/179840737
Change-Id: I6385e157e9a883cdd65f5ef9be89bcc3a29324fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56720
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Kai Ninomiya 2021-07-01 01:43:34 +00:00 committed by Dawn LUCI CQ
parent 3a75b1cea8
commit 211b4aae7e
1 changed files with 1 additions and 1 deletions

View File

@ -126,7 +126,7 @@ TEST(Ref, DefaultsToNull) {
Ref<RCTest> test; Ref<RCTest> test;
EXPECT_EQ(test.Get(), nullptr); EXPECT_EQ(test.Get(), nullptr);
EXPECT_EQ(test->GetThis(), nullptr); // Can't check GetThis() returns nullptr, as it would be undefined behavior.
} }
// Test Ref's copy constructor // Test Ref's copy constructor