[PATCH] D44988: [Sema] Fix decrement availability for built-in types

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 6 18:52:59 PDT 2018


vsapsai added inline comments.


================
Comment at: test/SemaCXX/overloaded-builtin-operators.cpp:95-99
   // C++ [over.built]p3
   long l1 = lr--;
 
+  // C++ [over.built]p4
+  float f1 = fr--;
----------------
Looks like p3 for `lr--` is a typo because p3 is about `++` while p4 is about `--`. It means the existing test didn't catch this bug. Not sure that adding another positive test will reliably prevent a regression in the future. Currently `FloatRef` is the type to expose the bug because `FloatTy` is the first type in `ArithmeticTypes`.

What if we add a negative test? I.e. something that would fail like
```
cannot decrement value of type 'BoolRef'
```
Also we can improve testing for p3 and test that `BoolRef` does support increment.


Repository:
  rC Clang

https://reviews.llvm.org/D44988





More information about the cfe-commits mailing list