This hooks up the detailed diagnostics why constant initialization was not possible if require_constant_initialization reports an error. I have updated the test to account for the new notes.
Everything works fine, except that in C++11 mode we get:
error: 'note' diagnostics expected but not seen: File /data/llvm/tools/clang/test/SemaCXX/attr-require-constant-initialization.cpp Line 229 (directive at /data/llvm/tools/clang/test/SemaCXX/attr-require-constant-initialization.cpp:231): non-constexpr constructor 'NonLit' cannot be used in a constant expression error: 'note' diagnostics seen but not expected: (frontend): non-literal type 'NonLit' cannot be used in a constant expression
This is because of an ImplicitValueInitExpr that gets passed into CheckLiteralType, but since ImplicitValueInitExpr doesn't have source information we get an invalid source location. I'm not really sure how to fix that (Is it possible to test for a note without source location?). Adding the proper source locations to ImplicitValueInitExpr seemed like a bigger undertaking than was warranted for this patch, so I'd appreciate guidance on how to proceed.