[PATCH] D57852: [clang-tidy] Don't use assignment for value-initialized enums

Malcolm Parsons via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 7 06:48:36 PST 2019


malcolm.parsons marked an inline comment as done.
malcolm.parsons added a comment.

In D57852#1388526 <https://reviews.llvm.org/D57852#1388526>, @JonasToth wrote:

> How are the semantics for `enum class` in this case?


No enumerators are present in the initialisation or the fixit, so there is no difference.



================
Comment at: clang-tools-extra/test/clang-tidy/modernize-use-default-member-init-assignment.cpp:172
+  // CHECK-FIXES: PositiveValueEnum()  {}
+  Enum e;
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use default member initializer for 'e'
----------------
JonasToth wrote:
> What happens for the case `enum Enum { Foo = 3 }; /* ... */ : e() /* ... */`, is that even well formed?
> I feel a testcase along those lines is missing.
There are no errors or warnings from gcc or clang for that code.
Adding a testcase wouldn't increase coverage.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57852/new/

https://reviews.llvm.org/D57852





More information about the cfe-commits mailing list