Continuing to make Lit tests C++11 compatibility.
11 tests in this patch.
CodeGenCXX/debug-info-use-after-free.cpp
Mark base class destructor “~AAA(){}” as “protected” so that the derived class “C3” can inherit from it. Otherwise we would get the following Error in C++11: C++11: error: deleted function '~C3' cannot override a non-deleted function note: overridden virtual function is here
CodeGenCXX/dynamic-cast-hint.cpp
Mark base class destructors protected so that they can be inherited. Otherwise we would get the following Error in C++11: C++11: error: deleted function '~C' cannot override a non-deleted function note: overridden virtual function is here
SemaCXX/i-c-e-cxx.cpp
This test verifies GNU extensions. Change in diagnostics. C++98: error: expression is not an integral constant expression C++11: error: case value is not a constant expression Restrict the following to C++98: C++98: note: read of object outside its lifetime is not allowed in a constant expression C++98: warning: no case matching constant switch condition '1' C++98: warning: in-class initializer for static data member is not a constant expression; folding it to a constant is a GNU extension C++98: warning: 'long long' is a C++11 extension [-Wc++11-long-long] C++98: warning: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant] note: initializer of 'nonconst' is not a constant expression note: declared here
SemaCXX/new-delete.cpp
C++11 has one additional note following no matching constructor error. Existing: error: no matching constructor for initialization of 'S' Existing: note: candidate constructor (the implicit copy constructor) not viable C++11: candidate constructor (the implicit move constructor) not viable Change in diagnostics (2 instances) C++98: error: array size expression must have integral or enumeration type, not 'S' C++11: error: array size expression must have integral or unscoped enumeration type, not 'S' Change in diagnostics C++98: error: expected expression C++11: error: expected variable name or 'this' in lambda capture list C++98: error: no suitable member 'operator delete' in 'X11' note: member 'operator delete' declared here note: implicit destructor for 'X11' first required here C++11: error: deleted function '~X11' cannot override a non-deleted function note: overridden virtual function is here error: attempt to use a deleted function note: virtual destructor requires an unambiguous, accessible 'operator delete' C++98: error: field of type 'ArrayNewNeedsDtor::A' has private destructor note: declared private here note: implicit destructor for 'ArrayNewNeedsDtor::B' first required here C++11: error: attempt to use a deleted function note: destructor of 'B' is implicitly deleted because field 'a' has an inaccessible destructor
SemaCXX/no-wchar.cpp
C++11 had deprecated wchar_t. Change in diagnostics. C++98: conversion from string literal to 'wchar_t *' (aka 'unsigned short *') is deprecated C++11: ISO C++11 does not allow conversion from string literal to 'wchar_t *' (aka 'unsigned short *')
SemaCXX/virtual-member-functions-key-function.cpp
Change in diagnostics (2 instances) C++98: error: no suitable member 'operator delete' in 'B' note: member 'operator delete' declared here note: implicit destructor for 'B' first required here C++11: error: deleted function '~B' cannot override a non-deleted function note: overridden virtual function is here
SemaCXX/warn-bool-conversion.cpp
C++11 is more strict with pointer initializations. Boolean literal conversion diagnostics changed from Warning in C++98/03 to Error with Note in C++11. C++98: warning: initialization of pointer of type 'int *' to null from a constant boolean expression [-Wbool-conversion] C++11: error: cannot initialize a variable of type 'int *' with an rvalue of type 'bool' C++98: warning: initialization of pointer of type 'int *' to null from a constant boolean expression [-Wbool-conversion] C++11: error: cannot initialize a parameter of type 'int *' with an rvalue of type 'bool' note: passing argument to parameter 'j' here C++98: warning: initialization of pointer of type 'int *' to null from a constant boolean expression [-Wbool-conversion] C++11: error: no matching function for call to 'foo' note: candidate function not viable: requires 2 arguments, but 1 was provided Calling the function “void foo(int* i, int *j=(false))” with one actual argument was OK in C++98/03, but is an Error in C++11. Added the following. C++11: Error: no matching function for call to 'foo'.
SemaCXX/zero-length-arrays.cpp
In this test, class Bar has contains 3 zero-length arrays of class Foo. Class Foo has a private copy constructor. Bar’s implicit copy constructor was considered undefined was C++98/03, it is considered deleted in C++11. [class.copy] 12.8 \ 11. http://en.cppreference.com/w/cpp/language/copy_constructor#Deleted_implicitly-declared_copy_constructor Added the followed expected diagnostics for C++11. C++11: error: call to implicitly-deleted copy constructor of 'Bar' note: copy constructor of 'Bar' is implicitly deleted because field 'foos' has an inaccessible copy constructor
SemaTemplate/instantiate-c99.cpp
Added static_cast<>() inside designated initializers. Otherwise compiling this test in C++11 would result in the following Error. C++11: error: non-constant-expression cannot be narrowed from type 'int' to 'float' in initializer list [-Wc++11-narrowing]
SemaTemplate/temp_explicit.cpp
Restrict the following to C++98. C++98: warning: explicit instantiation of 'X0<char, char>' that occurs after an explicit specialization will be ignored (C++11 extension) [-Wc++11-extensions] note: previous template specialization is here Change in severity for the follow 3 diagnostics. C++98: warning: explicit instantiation of 'Inner2' not in a namespace enclosing 'N2' C++11: error: explicit instantiation of 'Inner2' not in a namespace enclosing 'N2' C++98: warning: explicit instantiation of 'N1::X7' must occur in namespace 'N1' C++11: error: explicit instantiation of 'N1::X7' must occur in namespace 'N1' C++98: warning: explicit instantiation of 'X9' must occur at global scope C++11: error: explicit instantiation of 'X9' must occur at global scope
SemaTemplate/value-dependent-null-pointer-constant.cpp
String literal and int is no longer compatible in C++11. Added 3 expected Errors for C++11. C++11: error: incompatible operand types ('const char *' and 'int') C++11: error: incompatible operand types ('int' and 'const char *') C++11: error: comparison between pointer and integer ('const char *' and 'int')