Fix DCHECK to handle dangling else (#18295)
authorJiakai Liu <liujiakai@fb.com>
Fri, 22 Mar 2019 21:01:41 +0000 (14:01 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 22 Mar 2019 21:04:29 +0000 (14:04 -0700)
commite5eb871419fc80799a8126fefe147d8fb4a04a2f
treeee9d393cf2fd99d458222a221072c923f1402a7f
parented47b85d3bd9c33ed723d2ae5309bebb4d619ac6
Fix DCHECK to handle dangling else (#18295)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18295

Replace "if (false)" with "while (false)" which fixes potential dangling else issue as shown in added test case.

Reviewed By: ezyang

Differential Revision: D14569608

fbshipit-source-id: 407052db9182ce27b7a59841e90fa50d3eca262e
c10/test/util/logging_test.cpp
c10/util/logging_is_not_google_glog.h