24 tests have been updated for C++11 compatibility.
CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp
Ambiguous class member lookup has been fixed in C++11 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1111 Restrict the following diagnostics to C++98. C++98: warning: lookup of 'set' in member access expression is ambiguous; using member of 'Value' note: lookup in the object type 'Value' refers here note: lookup from the current scope refers here
CXX/class/class.friend/p1.cpp
Restrict the following diagnostics to C++98. C++98 error: friends cannot be members of the declaring class
CXX/class/class.friend/p2.cpp
Restrict the following 2 diagnostics to C++98. C++98: warning: non-class friend type 'int' is a C++11 extension C++98: warning: unelaborated friend declaration is a C++11 extension; specify 'struct' to befriend 'B0'
CXX/stmt.stmt/stmt.dcl/p3.cpp
Definition of POD has been relaxed in C++11 such that a struct with a trivial copy assignment operator is still considered POD. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2294.html In the above paper, the following clause has been crossed out. “and has no user-declared copy assignment operator and no user-declared destructor” For this test, struct Z is still a POD struct in C++11. Therefore goto can jump over Z’s instantiation without causing a compiler Error. Restrict the following to C++98 C++98: error: cannot jump from this goto statement to its label C++98: note: jump bypasses initialization of non-POD variable
CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
C++11 accepts arbitrary literal types for non-type template parameters http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3413.html Change in diagnostics. C++98: error: non-type template argument for template parameter of pointer type 'int *' must have its address taken C++11: error: non-type template argument of type 'int' is not a constant expression note: read of non-const variable 'i' is not allowed in a constant expression note: declared here Restrict the following to C++98 C++98: warning: non-type template argument referring to object 'ki' with internal linkage is a C++11 extension Note: non-type template argument refers to object here Change in diagnostics. C++98: error: non-type template argument refers to thread-local object note: non-type template argument refers here C++11: error: non-type template argument of type 'int *' is not a constant expression note: template parameter is declared here Restrict the following to C++98 C++98: non-type template argument referring to function 'f_internal' with internal linkage is a C++11 extension note: non-type template argument refers to function here Change in diagnostics C++98: error: non-type template argument refers to object 'n' that does not have linkage note: non-type template argument refers to object here C++11: error: non-type template argument of type 'int *' is not a constant expression note: pointer to 'n' is not a constant expression note: declared here note: template parameter is declared here Change in diagnostics C++98: error: non-type template argument for template parameter of pointer type 'int *' must have its address taken C++11: error: non-type template argument of type 'int *' is not a constant expression note: read of non-constexpr variable 'iptr' is not allowed in a constant expression note: declared here
CXX/temp/temp.arg/temp.arg.type/p2.cpp
Unnamed types can now be used as template arguments in C++11 http://stackoverflow.com/questions/5131691/what-is-an-unnamed-type-in-c Restrict the following diagnostics to C++98. C++98: Warning: template argument uses unnamed type
CXX/temp/temp.fct.spec/temp.deduct/p9.cpp
Template argument constant expression narrowing is not allowed. http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1809 Restrict the following diagnostics to C++98. C++98: error: call to 'f' is ambiguous note: candidate function note: candidate function
CXX/temp/temp.spec/no-body.cpp
Explicit instantiation of a template inside a nested namespace is an Error in C++11. This could be the result of the following defect fix. http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#995 Added 3 instances of the following diagnostics. C++11: error: explicit instantiation of 'x' must occur at global scope note: explicit instantiation refers here Also remove these 3 explicit instantiations from the -fixit runs.
CodeGenCXX/const-init.cpp
Use constexpr instead of const in C++11 so the compiler does not complain. C++98: static const double d = 1.0; C++11: static constexpr double d = 1.0;
Parser/cxx-class.cpp
Change in diagnostics for malformed class member definitions without parenthesis.
In C++11, this looks like malformed initializer lists.
C++98: error: function definition does not declare parameters C++11: error: expected expression error: expected '}' note: to match this '{' error: expected ';' after class error: extraneous closing brace C++98: error: function definition does not declare parameters C++11: error: variable has incomplete type 'void' error: expected ';' after top level declarator Restrict 6 instances of the following to C++98 C++98: in-class initialization of non-static data member is a C++11 extension
Parser/cxx-decl.cpp
Restrict 1 instance of the following to C++98 C++98: error: commas at the end of enumerator lists are a C++11 extension Restrict 2 instances of the following to C++98 C++98: error: rvalue references are a C++11 extension Change in diagnostics as a result of attribute list in C++11 C++98: error: expected expression error: expected unqualified-id C++11: error: an attribute list cannot appear here Restrict 1 instance of the following to C++98 C++98: error: alias declarations are a C++11 extension Restrict 1 instance of the following to C++98 C++98: error: 'template' keyword outside of a template Add 1 instance of the following to C++11 C++11: error: 'friend' must appear first in a non-function declaration Change in diagnostics for unmatched braces at end of file. C++98: error: expected ';' after top level declarator C++11: error: expected expression error: expected '}' note: to match this '{' error: expected ';' after top level declarator
Parser/cxx-friend.cpp
C++11 allows unelaborated friend declarations and non-class friend types. Restrict the following diagnostics to C++98. C++98: warning: unelaborated friend declaration is a C++11 extension; specify 'class' to befriend 'C' C++98: warning: unelaborated friend declaration is a C++11 extension; specify 'union' to befriend 'U' C++98: warning: non-class friend type 'int' is a C++11 extension
SemaCXX/anonymous-struct.cpp
In C++11, struct member ‘x’ of type S is still POD since there is nothing in the constructor. http://www.stroustrup.com/C++11FAQ.html#PODs Restrict the following diagnostics to C++98. C++98: error: anonymous struct member 'x' has a non-trivial constructor note: because type 'S' has a user-provided default constructor C++11 allows unnamed types for template arguments Restrict the following diagnostics to C++98. C++98: warning: template argument uses unnamed type note: unnamed type used in template argument was declared here
SemaCXX/class.cpp
Change in diagnostics regarding ‘auto’ C++98: warning: 'auto' storage class specifier is redundant C++11: warning: 'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases Restrict the following diagnostics to C++98. C++98: warning: in-class initialization of non-static data member is a C++11 extension Add the following diagnostics to C++11. C++11: error: static const volatile data member must be initialized out of line For the last part, slightly modify the test by changing const to constexpr for C++11 in C++98 we still test for static const float x = 5.0f; static const float y = foo(); in C++11 we test for static constexpr float x = 5.0f; static constexpr float y = foo(); for the above C++11 case Assigning 5.0f to x no longer issues any diagnostics. Assigning foo’s return to y generates the following diagnostics. C++11: error: constexpr variable 'y' must be initialized by a constant expression error: constexpr variable 'y' must be initialized by a constant expression note: declared here
SemaCXX/conversion-function.cpp
Diagnostic wordings changed from C++98 to C++11 2 Changes in diagnostics between C++98 and C++11 C++98: warning: C++98 requires an accessible copy constructor for class 'A1' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] C++11: warning: copying parameter of type 'A1' when binding a reference to a temporary would invoke an inaccessible constructor in C++98 [-Wc++98-compat-bind-to-temporary-copy] C++98: error: cannot specify any part of a return type in the declaration of a conversion function C++11: error: cannot specify any part of a return type in the declaration of a conversion function; use an alias template to declare a conversion to 'T (&)()' 1 extra note diagnostics for move candidate constructor. C++11: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'smart_ptr::Y' to 'smart_ptr::X &&' for 1st argument 1 Change in diagnostics wording non-POD became non-trivial C++98: error: cannot pass object of non-POD type 'Other' through variadic constructor; call will abort at runtim C++11: error: cannot pass object of non-trivial type 'Other' through variadic constructor; call will abort at runtim
SemaCXX/cxx1y-variable-templates_in_class.cpp
SemaCXX/cxx1y-variable-templates_top_level.cpp
These 2 tests check for variable template support in 3 dialects: C++98, C++11 and C++14 Since the first run line of each test specifically test for pre C++11 behavior, simply add –std=c++98 to the first RUN line.
SemaCXX/exceptions.cpp
C++11 no longer issues an error regarding pointer to incomplete type inside throw(). This appears valid since dynamic exception specifications aka throw() has been deprecated. And that “parameter packs are allowed in C++11.” http://en.cppreference.com/w/cpp/language/except_spec Restrict the following group of 3 diagnostics to C++98 C++98: error: pointer to incomplete type 'Decay::E' is not allowed in exception specification note: in instantiation of template class 'Decay::C<Decay::E [10]>' requested here note: forward declaration of 'Decay::E' Also, restrict the rvalue reference diagnostics to C++98. C++98: warning: rvalue references are a C++11 extension
SemaCXX/qual-id-test.cpp
Ambiguous class member lookup has been fixed in C++11 Restrict the following diagnostics to C++98. C++98: error: lookup of 'base' in member access expression is ambiguous note: lookup in the object type 'A::sub' refers here note: lookup from the current scope refers here
SemaCXX/unused.cpp
In C++11, volatile-qualified lvalue undergoes lvalue-to-rvalue conversion inside discared-value expressions. The statement *x; is a discared-value expression of a lvalue of an indirection. Therefore *x; considered a use of x in C++11. http://open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1054 http://stackoverflow.com/questions/20242868/correct-behaviour-of-trivial-statements-involving-expressions-with-volatile-vari Restrict the following diagnostics to C++98. C++98: warning: expression result unused; assign into a variable to force a volatile load
SemaCXX/warn-unused-value.cpp
Simular to previous test case, volatile in a discared-value expression is now a use in C++11 Restrict the following diagnostics to C++98. C++98: warning: expression result unused; assign into a variable to force a volatile load
SemaTemplate/member-access-expr.cpp
Ambiguous class member lookup has been fixed in C++11 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1111 Restrict the following diagnostics to C++98. C++98: error: lookup of 'CrazyBase' in member access expression is ambiguous note: lookup in the object type 'X1' refers here note: lookup from the current scope refers here
SemaTemplate/recovery-crash.cpp
C++11 allows the use of local types as template arguments. Restrict the following diagnostics to C++98. C++98: warning: template argument uses local type 'LocalStruct' note: in instantiation of function template specialization
SemaTemplate/temp_arg_type.cpp
C++11 allows both local type and unnamed type to be used in template arguments. Restrict the following diagnostics to C++98. C++98: warning: template argument uses local type 'X' C++98: warning: template argument uses unnamed type note: unnamed type used in template argument was declared here