<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Essentially LGTM. A few comments below, feel free to commit once you've addressed them.</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Tue, Nov 24, 2015 at 9:53 AM, Li, Charles <span dir="ltr"><<a href="mailto:charles_li@playstation.sony.com" target="_blank">charles_li@playstation.sony.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p>Hi Everyone,<u></u><u></u></p>
<p><u></u> <u></u></p>
<p><u></u> <u></u></p>
<p>I am continuing with updating Lit tests to be C++11 compatible.<u></u><u></u></p>
<p>Here is the fifth patch. This patch contains 20 tests.</p></div></div></blockquote><div><br></div><div>+#if __cplusplus <= 199711L // C++03 or earlier<br></div><div><br></div><div>I don't think these comments are useful. It's reasonable to expect that anyone updating Clang's C++ conformance tests knows what __cplusplus means.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p><u></u><u></u></p>
<p>These are mostly diagnostics changes due to new C++11 features and changes in the standard.<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>Here are the explanations for each test in the order that they appear in the patch.
<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>CXX/class/class.nest/p1.cpp<u></u><u></u></p>
<p> Sizeof has been extended to apply to non-static data members without an object [n2253].<u></u><u></u></p>
<p> Restrict the following to C++98/03.<u></u><u></u></p>
<p> error: invalid use of non-static data member 'x'<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>Parser/cxx-casting.cpp<u></u><u></u></p>
<p> Restrict Digraph errors to C++98/03.<u></u><u></u></p>
<p> C++98 error: found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>Parser/cxx-reference.cpp<u></u><u></u></p>
<p> rvalue references is now support<u></u><u></u></p>
<p> Restrict the following to C++98/03.<u></u><u></u></p>
<p> C++98 Warning rvalue references are a C++11 extension<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>Parser/cxx-template-argument.cpp<u></u><u></u></p>
<p> Consecutive right angle brackets is no longer a syntax error in C++11<u></u><u></u></p>
<p> Restrict the following to C++98/03<u></u><u></u></p>
<p> C++98: error: a space is required between consecutive right angle brackets (use '> >')<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>Parser/cxx-typeof.cpp<u></u><u></u></p>
<p> Using __typeof to derive the type of a non-static data member was an Error in C++98/03. It is now accepted in in C++11.<u></u><u></u></p>
<p> Note 1: I could not find GCC documentation on this change,
<u></u><u></u></p>
<p> but given C++11 has decltype now works on non-static data members, this appears logical.<u></u><u></u></p>
<p> Note 2: This test uses GNU extension "typeof". <u></u><u></u></p>
<p> Therefore the Runs line are expanded with -std=gnu++98 and "-std=gnu++11"
<u></u><u></u></p>
<p> instead of the usual "-std=c++98" and "-std=c++11"<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>Parser/objc-init.m<u></u><u></u></p>
<p> Added C++11 error and note diagnostics on narrowing conversion.<u></u><u></u></p>
<p> Error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list<u></u><u></u></p>
<p> Note: insert an explicit cast to silence this issue<u></u><u></u></p>
<p> *Please Note: Since this is an Objective-C test, the Run line has not been changed.</p></div></div></blockquote><div><br></div><div>You should be able to split the -x objective-c++ RUN: line into two.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div>
<p>Parser/<a href="http://objcxx-lambda-expressions-neg.mm" target="_blank">objcxx-lambda-expressions-neg.mm</a><u></u><u></u></p>
<p> []{}; is now an valid Lambda expression.<u></u><u></u></p>
<p> Restrict "warning: expected expression" to C++98/03.<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaCXX/decl-expr-ambiguity.cpp<u></u><u></u></p>
<p> Change in ambiguity diagnostics due to introduction of initializer list.<u></u><u></u></p>
<p> C++11 has 1 extra Note following the pre-existing warning<u></u><u></u></p>
<p> warning: empty parentheses interpreted as a function declaration [-Wvexing-parse]<u></u><u></u></p>
<p> note: replace parentheses with an initializer to declare a variable<u></u><u></u></p>
<p><u></u> <u></u></p>
<p> *Note: The Run lines are left as-is because this test verifies for default diagnostic for "typeof"<u></u><u></u></p>
<p> Diagnostics will change if I explicitly specify any dialect.<u></u><u></u></p>
<p> Default (no -std=<dialect> flag): error: extension used [-Werror,-Wlanguage-extension-token]<u></u><u></u></p>
<p> C++ (-std=c++<number> flag): error: expected '(' for function-style cast or type construction<u></u><u></u></p>
<p> GNU++ (-std=gnu++<number> flag): No diagnostic.</p></div></div></blockquote><div><br></div><div>The default mode is gnu++98; specifying -std=gnu++98 should not cause a change in behavior. Did you perhaps accidentally remove the -pedantic-errors flag when you added -std=gnu++98?<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p><u></u></p>
<p>SemaCXX/overload-call.cpp<u></u><u></u></p>
<p> This change has 3 separate issues. First two are overload resolutions. Last one is C++98/03 specific diagnostic.<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>1. When the actual arg is a string literal and 2 candidate functions exist. One with formal argument “char *”, the other with “bool”<u></u><u></u></p>
<p> In C++98/03, Clang picks "char *" and issues a deprecated writable wring diagnostics.<u></u><u></u></p>
<p> In C++11 , Clang uses picks the "bool" candidate and issues a return type miss match diagnostics.<u></u><u></u></p>
<p> Default converstion from "const char *" to "bool" came from C++11 standard 4.12\1 [conv.bool]<u></u><u></u></p>
<p> Reference: <a href="http://stackoverflow.com/questions/26413951/overloaded-bool-string-ambiguity" target="_blank">
http://stackoverflow.com/questions/26413951/overloaded-bool-string-ambiguity</a><u></u><u></u></p>
<p> The difference in diagnostics are as follows:<u></u><u></u></p>
<p> C++98 (argument type mismatch): conversion from string literal to 'char *' is deprecated<u></u><u></u></p>
<p> C++11 (return type mismatch): cannot initialize a variable of type 'int *' with an rvalue of type 'double *'<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>2. Similar to point 1. This time the 2 overloaded functions have formal args "char *" and "void *".<u></u><u></u></p>
<p> In this case Clang picks "char *" but issues a slightly different error:<u></u><u></u></p>
<p> C++98 warning: conversion from string literal to 'char *' is deprecated
<u></u><u></u></p>
<p> C++11 warning: ISO C++11 does not allow conversion from string literal to 'char *'<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>3. Restrict the following diagnostics to C++98/03<u></u><u></u></p>
<p> Warning: rvalue references are a C++11 extension<u></u><u></u></p>
<p> Warning: deleted function definitions are a C++11 extension<u></u><u></u></p>
<p><u></u> <u></u></p>
<p><u></u> <u></u></p>
<p>SemaCXX/pragma-init_seg.cpp<u></u><u></u></p>
<p> In C++11 Clang issues an additional note follow pre-existing error.<u></u><u></u></p>
<p> Add the following Note to C++11.<u></u><u></u></p>
<p> Error: initializer for thread-local variable must be a constant expression<u></u><u></u></p>
<p> Note: use 'thread_local' to allow this<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaCXX/typo-correction-delayed.cpp<u></u><u></u></p>
<p> C++11 allows initializer list to be pass as actual arguments.<u></u><u></u></p>
<p> Restrict the following to C++98<u></u><u></u></p>
<p> error: expected expression<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaCXX/unknown-type-name.cpp<u></u><u></u></p>
<p> Restrict the following to C++98<u></u><u></u></p>
<p> Warning: deleted function definitions are a C++11 extension<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaCXX/writable-strings-deprecated.cpp<u></u><u></u></p>
<p> Writable strings generates different diagnostics between C++98/03 and C++11.
<u></u><u></u></p>
<p> By default, at both dialects issues warning. <u></u><u></u></p>
<p> C++98: warning: conversion from string literal to 'char *' is deprecated [-Werror,-Wc++11-compat-deprecated-writable-strings]<u></u><u></u></p>
<p> C++11: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]<u></u><u></u></p>
<p> This test verifies for -W flag's modifications to the severity level of the above diagnostics.<u></u><u></u></p>
<p> I have refectories the preprocessor code The expected Warning or Error now corresponds to the C++ dialect level.<u></u><u></u></p>
<p> I have made the C++ dialect on the RUN lines explicit. <u></u>
<u></u></p>
<p> In the process I added 2 RUN lines, default with no -W switches and C98 with no -W switches.<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaObjCXX/<a href="http://message.mm" target="_blank">message.mm</a><u></u><u></u></p>
<p> Tyename can now be used outside of tempalte<u></u><u></u></p>
<p> Restrict the following to C++98<u></u><u></u></p>
<p> warning: 'typename' occurs outside of a template<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaTemplate/instantiate-function-2.cpp<u></u><u></u></p>
<p> Restrict the following to C++98<u></u><u></u></p>
<p> warning: alias declarations are a C++11 extension<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaTemplate/instantiate-static-var.cpp<u></u><u></u></p>
<p> Diagnostic changes in C++11 with the introduction of "constexpr"<u></u><u></u></p>
<p> C++98: warning: in-class initializer for static data member of type 'const float' is a GNU extension<u></u><u></u></p>
<p> C++11: error: in-class initializer for static data member of type 'const float' requires 'constexpr' specifier<u></u><u></u></p>
<p> C++11: note: add 'constexpr'<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaTemplate/nested-name-spec-template.cpp<u></u><u></u></p>
<p> The keyword “template” can now be used outside of templates.<u></u><u></u></p>
<p> Restrict warning to C++98/03.<u></u><u></u></p>
<p> Warning: 'template' keyword outside of a template<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaTemplate/overload-candidates.cpp<u></u><u></u></p>
<p> Only checks the following diagnostics for C++98/03<u></u><u></u></p>
<p> warning: default template arguments for a function template are a C++11 extension<u></u><u></u></p>
<p> warning: alias declarations are a C++11 extension<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaTemplate/partial-spec-instantiate.cpp<u></u><u></u></p>
<p> problem/9169404 tests for narrowing -1 to bool<u></u><u></u></p>
<p> Narrowing conversion is now an error in C++11<u></u><u></u></p>
<p> Added verification for the following at C++11<u></u><u></u></p>
<p> Error: non-type template argument evaluates to -1, which cannot be narrowed to type 'bool'<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>SemaTemplate/temp_arg_template.cpp<u></u><u></u></p>
<p> Restrict digraph and variadic template diagnostics to C++98<u></u><u></u></p>
<p><u></u> <u></u></p>
<p><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</blockquote></div><br></div></div>