<div dir="ltr">Justin - didn't you, or someone, play around with making a utility for enums that represent flags to work more betterer?<br><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 29, 2016 at 11:31 AM Victor <<a href="mailto:vleschuk@gmail.com">vleschuk@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">vleschuk added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D23766#528004" rel="noreferrer" target="_blank">https://reviews.llvm.org/D23766#528004</a>, @dblaikie wrote:<br>
<br>
> Why is it that we aren't just using teh DIFlags type directly everywhere we are currently using unsigned (everywhere you're changing to DIFlagsUnderlying)?<br>
<br>
<br>
Because constructions like the following do not compile<br>
<br>
  enum DIFlags: uint32_t<br>
  {<br>
      Flag1 = 1,<br>
      Flag2 = 1 << 2,<br>
      Flag3 = 1 << 3,<br>
  };<br>
<br>
  // ....<br>
<br>
  DIFlags Flags = Flag1 | Flag2; // expression (Flag1 | Flag2) isn't DIFlags, it results in underlying type<br>
<br>
<br>
<br>
  clang++ -std=c++11 t.cpp -o t<br>
  t.cpp:12:13: error: cannot initialize a variable of type 'DIFlags' with an rvalue of type 'unsigned int'<br>
      DIFlags Flags = Flag1 | Flag2;<br>
              ^       ~~~~~~~~~~~~~<br>
  1 error generated.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D23766" rel="noreferrer" target="_blank">https://reviews.llvm.org/D23766</a><br>
<br>
<br>
<br>
</blockquote></div></div>