[PATCH] D55270: [Sema] Further improvements to to static_assert diagnostics.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 6 09:24:35 PST 2018


aaron.ballman added inline comments.


================
Comment at: test/PCH/cxx-static_assert.cpp:17
 
-// expected-error at 12 {{static_assert failed "N is not 2!"}}
+// expected-error at 12 {{static_assert failed due to requirement '1 == 2' "N is not 2!"}}
 T<1> t1; // expected-note {{in instantiation of template class 'T<1>' requested here}}
----------------
I'm not certain how I feel about now printing the failure condition when there's an explicit message provided. From what I understand, a fair amount of code in the wild does `static_assert(some_condition, "some_condition")` because of older language modes where the message was not optional. I worry we're going to start seeing a lot of diagnostics like: `static_assert failed due to requirement '1 == 2' "N == 2"`, which seems a bit low-quality. See `DFAPacketizer::DFAPacketizer()` in LLVM as an example of something similar.

Given that the user entered a message, do we still want to show the requirement? Do we feel the same way if the requirement is fairly large?


Repository:
  rC Clang

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

https://reviews.llvm.org/D55270





More information about the cfe-commits mailing list