Re: [PATCH] D19068: Lit C++11 Compatibility Patch #7

2016-04-13 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL266239: Lit C++11 Compatibility Patch #7 (authored by 
lcharles).

Changed prior to commit:
  http://reviews.llvm.org/D19068?vs=53603&id=53607#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19068

Files:
  cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp
  cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
  cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp
  cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
  cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
  cfe/trunk/test/CodeGenCXX/debug-info-static-member.cpp
  cfe/trunk/test/SemaCXX/dcl_init_aggr.cpp
  cfe/trunk/test/SemaCXX/type-convert-construct.cpp
  cfe/trunk/test/SemaCXX/vararg-non-pod.cpp
  cfe/trunk/test/SemaTemplate/class-template-spec.cpp
  cfe/trunk/test/SemaTemplate/instantiate-cast.cpp
  cfe/trunk/test/SemaTemplate/instantiate-expr-4.cpp
  cfe/trunk/test/SemaTemplate/instantiate-member-class.cpp

Index: cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp
===
--- cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp
+++ cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 // This is just the test for [namespace.udecl]p4 with 'using'
 // uniformly stripped out.
@@ -24,10 +26,33 @@
   }
 
   class Test0 {
-NonClass::type; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}}
-NonClass::hiding; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}}
-NonClass::union_member; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}}
-NonClass::enumerator; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}}
+NonClass::type; // expected-error {{not a class}}
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
+#else
+// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+NonClass::hiding; // expected-error {{not a class}}
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
+#else
+// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+NonClass::union_member; // expected-error {{not a class}}
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
+#else
+// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+NonClass::enumerator; // expected-error {{not a class}}
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
+#else
+// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
   };
 }
 
@@ -43,11 +68,39 @@
   };
 
   struct B : A {
-A::type; // expected-warning {{access declarations are deprecated}}
-A::hiding; // expected-warning {{access declarations are deprecated}}
-A::union_member; // expected-warning {{access declarations are deprecated}}
-A::enumerator; // expected-warning {{access declarations are deprecated}}
-A::tagname; // expected-warning {{access declarations are deprecated}}
+A::type;
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
+#else
+// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+A::hiding;
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
+#else
+// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+A::union_member;
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
+#else
+// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+A::enumerator;
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
+#else
+// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
+#endif
+
+A::tagname;
+#if __cplusplus <= 199711L
+// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
+#else
+// expected-error@-4 {{ISO C++11 does not allow access declarati

[PATCH] D19068: Lit C++11 Compatibility Patch #7

2016-04-13 Thread Charles Li via cfe-commits
tigerleapgorge created this revision.
tigerleapgorge added a reviewer: rsmith.
tigerleapgorge added a subscriber: cfe-commits.

13 tests have been updated for C++11 compatibility.


CXX/class.access/class.access.dcl/p1.cpp
  Access declarations are deprecated in C++11.
  As a result, there are 4 types of diagnostics changes:

  For simple access declarations, there is a change in diagnostics.
C++98: warning: access declarations are deprecated; use using declarations 
instead
C++11: error: ISO C++11 does not allow access declarations; use using 
declarations instead

  For Self-referential access declarations, there is also an additional error 
message.
C++98: warning: access declarations are deprecated; use using declarations 
instead
C++11: error: ISO C++11 does not allow access declarations; use using 
declarations instead
C++11: error: using declaration refers to its own class

  For an access declaration of a non-base method, there is a different 
additional error message.
C++98: warning: access declarations are deprecated; use using declarations 
instead
C++11: error: ISO C++11 does not allow access declarations; use using 
declarations instead
C++11: error: using declaration refers into 'Subclass::', which is not a 
base class of 'C'

  For self-referential access declaration with local declaration, there is the 
additional error message but one less note message.
C++98: warning: access declarations are deprecated; use using declarations 
instead [-Wdeprecated]
C++98: error: using declaration refers to its own class
C++98: note: target of using declaration
C++11: error: ISO C++11 does not allow access declarations; use using 
declarations instead
C++11: error: using declaration refers to its own class

CXX/temp/temp.spec/temp.expl.spec/p2.cpp
  Guard multiple instances of the following diagnostics to C++98.
C++98: warning: first declaration of function template specialization of 
'f0' outside namespace 'N0' is a C++11 extension
C++98: note: explicitly specialized declaration is here

CXX/temp/temp.spec/temp.expl.spec/p3.cpp
  Guard one instance of the following diagnostics to C++98.
C++98: warning: first declaration of class template specialization of 'X' 
outside namespace 'N' is a C++11 extension
C++98: note: explicitly specialized declaration is here

CXX/temp/temp.spec/temp.explicit/p2.cpp
CXX/temp/temp.spec/temp.explicit/p5.cpp
  In C++98 with -Wc++11-compat, Out-of-scope explicit instantiations of 
template is a Warning.
  In C++11, it is now an Error.
C++98: warning: explicit instantiation of 'N::f1' must occur in namespace 
'N'
C++11: error: explicit instantiation of 'N::f1' must occur in namespace 'N'

CodeGenCXX/debug-info-static-member.cpp
  In C++11, replace “const” with “constexpr” for in-class static initializer of 
non-integral type.
  Otherwise compiler would complain: 
C++11: error: in-class initializer for static data member of type 'const 
float' requires 'constexpr' specifier

SemaCXX/dcl_init_aggr.cpp
  Diagnostic change due to initializer list
C++98: error: non-aggregate type 'NonAggregate' cannot be initialized with 
an initializer list
C++11: error no matching constructor for initialization of 'NonAggregate'
   note: candidate constructor (the implicit copy constructor) not 
viable
   note: candidate constructor (the implicit move constructor) not 
viable
   note: candidate constructor not viable

  Diagnostic Change
C++98: conversion from string literal to 'char *' is deprecated
C++11: ISO C++11 does not allow conversion from string literal to 'char *'

  Addition C++11 move constructor diagnostics
C++11: note: candidate constructor (the implicit move constructor) not 
viable

  The next 2 lines caused a lot of diff.
Source: TooFewError too_few_error = { 1 }
C++98: error: no matching constructor for initialization of 
'NoDefaultConstructor'
   note: candidate constructor not viable: requires 1 argument, but 0 
were provided
   note: candidate constructor (the implicit copy constructor) not 
viable
   note: in implicit initialization of field 'nodef' with omitted 
initializer
   error: implicit default constructor for 'TooFewError' must 
explicitly initialize
  the member 'nodef' which does not have a default constructor
   note: member is declared here
   note: 'NoDefaultConstructor' declared here

C++11: error: no matching constructor for initialization of 
'NoDefaultConstructor'
   note: candidate constructor not viable: requires 1 argument, but 0 
were provided
   note: candidate constructor (the implicit copy constructor) not 
viable
   note: candidate constructor (the implicit move constructor) not 
viable
   note: in implicit initialization of field 'nodef' with omitted 
initializer

Source: TooFewError too_few_okay2[2] = { 1, 1 };
C+