aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from a commenting request.



================
Comment at: test/Sema/warn-conditional-emum-types-mismatch.c:19
+
+int get_flag_anon_enum(int cond) {
+  return cond ? A : C;
----------------
xbolva00 wrote:
> aaron.ballman wrote:
> > xbolva00 wrote:
> > > Gcc warns here, but Clang does not warn when A != C..
> > > 
> > > So not sure here..
> > My gut reaction is that I think Clang should warn here as well because the 
> > code pattern is confusing, but I'd also say that if there's a lot of false 
> > positives where the code is sensible, it may make sense to suppress the 
> > diagnostic. One situation I was thinking of where you could run into 
> > something like this is:
> > ```
> > enum {
> >   STATUS_SUCCESS,
> >   STATUS_FAILURE,
> >   ...
> >   MAX_BASE_STATUS_CODE
> > };
> > 
> > enum ExtendedStatusCodes {
> >   STATUS_SOMETHING_INTERESTING = MAX_BASE_STATUS_CODE + 1000,
> >   ...
> > };
> > 
> > int whatever(void) {
> >   return some_condition() ? STATUS_SOMETHING_INTERESTING : STATUS_SUCCESS;
> > }
> > ```
> +1
Can you add some comments to the test case explaining that we purposefully 
differ from GCC here and why?


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

https://reviews.llvm.org/D67919



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to