diff options
author | John McCall <rjmccall@apple.com> | 2010-04-09 19:03:51 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-04-09 19:03:51 +0000 |
commit | 7002f4c03c2d0544f4e8bea8d3a5636519081e35 (patch) | |
tree | a6acb1bd60450f617e378f663e829273e0b1aef3 | |
parent | fd2254405de977dcc706a4dc7775c44a4218a27b (diff) |
Turn access control on by default in -cc1.
Remove -faccess-control from -cc1; add -fno-access-control.
Make the driver pass -fno-access-control by default.
Update a bunch of tests to be correct under access control.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100880 91177308-0d34-0410-b5e6-96231b3b80d8
48 files changed, 63 insertions, 47 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index e2ed171642..457744f369 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1153,10 +1153,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } // -fno-access-control is default (for now). - if (Args.hasFlag(options::OPT_faccess_control, - options::OPT_fno_access_control, - false)) - CmdArgs.push_back("-faccess-control"); + if (Args.hasFlag(options::OPT_fno_access_control, + options::OPT_faccess_control, + true)) + CmdArgs.push_back("-fno-access-control"); // -fexceptions=0 is default. if (needsExceptions(Args, InputType, getToolChain().getTriple())) diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 0ab70a9c16..f5f9ea4226 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -524,9 +524,8 @@ static void LangOptsToArgs(const LangOptions &Opts, } if (Opts.ObjCGCBitmapPrint) Res.push_back("-print-ivar-layout"); - // FIXME: Don't forget to update when the default changes! - if (Opts.AccessControl) - Res.push_back("-faccess-control"); + if (!Opts.AccessControl) + Res.push_back("-fno-access-control"); if (!Opts.CharIsSigned) Res.push_back("-fno-signed-char"); if (Opts.ShortWChar) @@ -1188,7 +1187,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding; Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new); Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions); - Opts.AccessControl = Args.hasArg(OPT_faccess_control); + Opts.AccessControl = !Args.hasArg(OPT_fno_access_control); Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors); Opts.MathErrno = Args.hasArg(OPT_fmath_errno); Opts.InstantiationDepth = getLastArgIntValue(Args, OPT_ftemplate_depth, 99, diff --git a/test/CXX/class.access/class.access.base/p1.cpp b/test/CXX/class.access/class.access.base/p1.cpp index 1bbcedb9a1..09884316f9 100644 --- a/test/CXX/class.access/class.access.base/p1.cpp +++ b/test/CXX/class.access/class.access.base/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // C++0x [class.access.base]p1(a): // If a class is declared to be a base class for another class using diff --git a/test/CXX/class.access/class.access.base/p5.cpp b/test/CXX/class.access/class.access.base/p5.cpp index 96037e7de2..938d9fbe9b 100644 --- a/test/CXX/class.access/class.access.base/p5.cpp +++ b/test/CXX/class.access/class.access.base/p5.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -faccess-control -verify %s +// RUN: %clang_cc1 -verify %s namespace test0 { struct A { diff --git a/test/CXX/class.access/class.access.nest/p1.cpp b/test/CXX/class.access/class.access.nest/p1.cpp index d2644c6ef4..eceffcf991 100644 --- a/test/CXX/class.access/class.access.nest/p1.cpp +++ b/test/CXX/class.access/class.access.nest/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Derived from GNU's std::string namespace test0 { diff --git a/test/CXX/class.access/class.friend/p1.cpp b/test/CXX/class.access/class.friend/p1.cpp index 22266cd8f8..7ea4f078d2 100644 --- a/test/CXX/class.access/class.friend/p1.cpp +++ b/test/CXX/class.access/class.friend/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // C++'0x [class.friend] p1: // A friend of a class is a function or class that is given permission to use diff --git a/test/CXX/class.access/class.protected/p1.cpp b/test/CXX/class.access/class.protected/p1.cpp index 949475cc66..6ff630c996 100644 --- a/test/CXX/class.access/class.protected/p1.cpp +++ b/test/CXX/class.access/class.protected/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s namespace test0 { class A { diff --git a/test/CXX/class.access/p4.cpp b/test/CXX/class.access/p4.cpp index 434d8e4fc1..9bed7cd8fe 100644 --- a/test/CXX/class.access/p4.cpp +++ b/test/CXX/class.access/p4.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // C++0x [class.access]p4: diff --git a/test/CXX/class.access/p6.cpp b/test/CXX/class.access/p6.cpp index aaf510a6d1..d51d75d05d 100644 --- a/test/CXX/class.access/p6.cpp +++ b/test/CXX/class.access/p6.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // C++0x [class.access]p6: // All access controls in [class.access] affect the ability to diff --git a/test/CXX/class/class.local/p2.cpp b/test/CXX/class/class.local/p2.cpp index 2b1359c3d8..db4c90f564 100644 --- a/test/CXX/class/class.local/p2.cpp +++ b/test/CXX/class/class.local/p2.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -faccess-control +// RUN: %clang_cc1 -fsyntax-only -verify %s struct A { }; diff --git a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp index f5fbf7a08c..c81e4ef1b1 100644 --- a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp +++ b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp @@ -50,7 +50,7 @@ namespace test1 { } namespace test2 { - class Unrelated { + struct Unrelated { void foo(); }; diff --git a/test/CXX/conv/conv.mem/p4.cpp b/test/CXX/conv/conv.mem/p4.cpp index 42f6343e06..e0748d8923 100644 --- a/test/CXX/conv/conv.mem/p4.cpp +++ b/test/CXX/conv/conv.mem/p4.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s struct Base { int data; diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp index 89e9c897d2..3581f79b0a 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // We have to avoid ADL for this test. diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp index 00234ac5fd..9ab0b489a2 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s class C { +public: void f(int i = 3); // expected-note{{here}} void g(int i, int j = 99); }; diff --git a/test/CXX/expr/expr.unary/expr.delete/p5.cpp b/test/CXX/expr/expr.unary/expr.delete/p5.cpp index 4b2b5ae7cb..2fa30e59dc 100644 --- a/test/CXX/expr/expr.unary/expr.delete/p5.cpp +++ b/test/CXX/expr/expr.unary/expr.delete/p5.cpp @@ -11,7 +11,7 @@ class T0 { ~T0(); }; // The trivial case, inside a template instantiation. template<typename T> -class T1_A { T *x; ~T1_A() { delete x; } }; // expected-warning {{deleting pointer to incomplete type}} +struct T1_A { T *x; ~T1_A() { delete x; } }; // expected-warning {{deleting pointer to incomplete type}} class T1_B; // expected-note {{forward declaration}} void f0() { T1_A<T1_B> x; } // expected-note {{in instantiation of member function}} diff --git a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp index cfa14f996b..e344eedfd6 100644 --- a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp +++ b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp @@ -1,13 +1,13 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -template<int I, int J, class T> class X { +template<int I, int J, class T> struct X { static const int value = 0; }; -template<int I, int J> class X<I, J, int> { +template<int I, int J> struct X<I, J, int> { static const int value = 1; }; -template<int I> class X<I, I, int> { +template<int I> struct X<I, I, int> { static const int value = 2; }; diff --git a/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/test/CXX/temp/temp.decls/temp.friend/p1.cpp index 597e06d292..03e51321bb 100644 --- a/test/CXX/temp/temp.decls/temp.friend/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.friend/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -faccess-control -verify -emit-llvm-only %s +// RUN: %clang_cc1 -verify -emit-llvm-only %s namespace test0 { template <typename T> struct Num { diff --git a/test/CXX/temp/temp.spec/temp.inst/p11.cpp b/test/CXX/temp/temp.spec/temp.inst/p11.cpp index d375beb10a..818407102c 100644 --- a/test/CXX/temp/temp.spec/temp.inst/p11.cpp +++ b/test/CXX/temp/temp.spec/temp.inst/p11.cpp @@ -5,7 +5,7 @@ namespace test0 { template<typename T> unsigned f0() { return T::MaxSize; // expected-error {{'int' cannot be used prior to '::'}} }; - template<typename T> class A { + template<typename T> struct A { void Allocate(unsigned Alignment = f0<T>()) // expected-note {{in instantiation}} {} diff --git a/test/CodeGenCXX/assign-operator.cpp b/test/CodeGenCXX/assign-operator.cpp index cb8867f2f6..805fe8df69 100644 --- a/test/CodeGenCXX/assign-operator.cpp +++ b/test/CodeGenCXX/assign-operator.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 %s -emit-llvm-only -verify class x { -int operator=(int); +public: int operator=(int); }; void a() { x a; diff --git a/test/CodeGenCXX/constructor-init-reference.cpp b/test/CodeGenCXX/constructor-init-reference.cpp index c2f41e1f0c..5e75159765 100644 --- a/test/CodeGenCXX/constructor-init-reference.cpp +++ b/test/CodeGenCXX/constructor-init-reference.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -emit-llvm -o - %s | grep "store i32\* @x, i32\*\*" int x; -class A { +struct A { int& y; A() : y(x) {} }; diff --git a/test/CodeGenCXX/constructors.cpp b/test/CodeGenCXX/constructors.cpp index 2c95c91e11..e0709055cd 100644 --- a/test/CodeGenCXX/constructors.cpp +++ b/test/CodeGenCXX/constructors.cpp @@ -12,7 +12,7 @@ struct ValueClass { /* Test basic functionality. */ -class A { +struct A { A(struct Undeclared &); A(ValueClass); Member mem; diff --git a/test/CodeGenCXX/default-destructor-nested.cpp b/test/CodeGenCXX/default-destructor-nested.cpp index 86942743d4..565a7279c5 100644 --- a/test/CodeGenCXX/default-destructor-nested.cpp +++ b/test/CodeGenCXX/default-destructor-nested.cpp @@ -2,7 +2,7 @@ // PR6294 class A { - virtual ~A(); +public: virtual ~A(); }; class B { class C; diff --git a/test/CodeGenCXX/instantiate-init-list.cpp b/test/CodeGenCXX/instantiate-init-list.cpp index 676d2994e7..49c6f51c77 100644 --- a/test/CodeGenCXX/instantiate-init-list.cpp +++ b/test/CodeGenCXX/instantiate-init-list.cpp @@ -5,7 +5,7 @@ struct F { }; void G(); template<class T> class A { - A(); +public: A(); }; template<class T> A<T>::A() { static F f = { G }; diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index ec9c08c0cc..ad57c199c4 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -450,7 +450,7 @@ namespace test7 { // CHECK: define weak_odr void @_ZN5test81AILZNS_1B5valueEEE3incEv namespace test8 { template <int &counter> class A { void inc() { counter++; } }; - class B { static int value; }; + class B { public: static int value; }; template class A<B::value>; } // CHECK: declare void @_ZN5test91fIiNS_3barEEEvRKNT0_3baz1XE diff --git a/test/CodeGenCXX/new-operator-phi.cpp b/test/CodeGenCXX/new-operator-phi.cpp index 38467ad31f..49859acf4f 100644 --- a/test/CodeGenCXX/new-operator-phi.cpp +++ b/test/CodeGenCXX/new-operator-phi.cpp @@ -2,7 +2,7 @@ // PR5454 #include <stddef.h> -class X {static void * operator new(size_t size) throw(); X(int); }; +struct X {static void * operator new(size_t size) throw(); X(int); }; int a(), b(); void b(int x) { diff --git a/test/CodeGenCXX/operator-new.cpp b/test/CodeGenCXX/operator-new.cpp index da64fc1b2d..f718faebef 100644 --- a/test/CodeGenCXX/operator-new.cpp +++ b/test/CodeGenCXX/operator-new.cpp @@ -6,6 +6,7 @@ class teste { int A; +public: teste() : A(2) {} }; diff --git a/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp b/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp index 921113a148..41ae08470a 100644 --- a/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp +++ b/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp @@ -4,6 +4,7 @@ class A { union { void *d; }; +public: A() : d(0) { } }; diff --git a/test/CodeGenCXX/template-instantiation.cpp b/test/CodeGenCXX/template-instantiation.cpp index 416c0a1a20..4a3857542d 100644 --- a/test/CodeGenCXX/template-instantiation.cpp +++ b/test/CodeGenCXX/template-instantiation.cpp @@ -40,6 +40,7 @@ namespace test1 { namespace test2 { template<typename T1> class C { + public: virtual ~C(); void zedbar(double) { } diff --git a/test/CodeGenCXX/virt-template-vtable.cpp b/test/CodeGenCXX/virt-template-vtable.cpp index 76a1240731..b968f38c82 100644 --- a/test/CodeGenCXX/virt-template-vtable.cpp +++ b/test/CodeGenCXX/virt-template-vtable.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s template<class T> class A { +public: A() {} virtual void a() {} }; diff --git a/test/FixIt/typo.cpp b/test/FixIt/typo.cpp index efc9ba890c..dc6789fa86 100644 --- a/test/FixIt/typo.cpp +++ b/test/FixIt/typo.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -fsyntax-only -fixit -o - %s | %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ - namespace std { template<typename T> class basic_string { // expected-note 2{{'basic_string' declared here}} + public: int find(const char *substr); // expected-note{{'find' declared here}} static const int npos = -1; // expected-note{{'npos' declared here}} }; diff --git a/test/SemaCXX/access-base-class.cpp b/test/SemaCXX/access-base-class.cpp index 25fd9e52aa..8551690216 100644 --- a/test/SemaCXX/access-base-class.cpp +++ b/test/SemaCXX/access-base-class.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s namespace T1 { class A { }; diff --git a/test/SemaCXX/access-control-check.cpp b/test/SemaCXX/access-control-check.cpp index 1db6704909..4540e99d8a 100644 --- a/test/SemaCXX/access-control-check.cpp +++ b/test/SemaCXX/access-control-check.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s class M { int iM; diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index 49bcd99fb6..cb78a2e65f 100644 --- a/test/SemaCXX/conditional-expr.cpp +++ b/test/SemaCXX/conditional-expr.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control -std=c++0x -Wsign-compare %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -Wsign-compare %s // C++ rules for ?: are a lot stricter than C rules, and have to take into // account more conversion options. diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp index 96dfa8ba52..8b23e13009 100644 --- a/test/SemaCXX/constructor-initializer.cpp +++ b/test/SemaCXX/constructor-initializer.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -Wreorder -fsyntax-only -verify %s class A { int m; +public: A() : A::m(17) { } // expected-error {{member initializer 'm' does not name a non-static data member or base class}} A(int); }; @@ -125,7 +126,7 @@ struct Q { // A silly class used to demonstrate field-is-uninitialized in constructors with // multiple params. -class TwoInOne { TwoInOne(TwoInOne a, TwoInOne b) {} }; +class TwoInOne { public: TwoInOne(TwoInOne a, TwoInOne b) {} }; class InitializeUsingSelfTest { bool A; char* B; diff --git a/test/SemaCXX/cstyle-cast.cpp b/test/SemaCXX/cstyle-cast.cpp index 6a28f4c2c8..ccb25f00c2 100644 --- a/test/SemaCXX/cstyle-cast.cpp +++ b/test/SemaCXX/cstyle-cast.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control %s +// RUN: %clang_cc1 -fsyntax-only -verify %s struct A {}; diff --git a/test/SemaCXX/direct-initializer.cpp b/test/SemaCXX/direct-initializer.cpp index d30642b5c3..54cd6cacc0 100644 --- a/test/SemaCXX/direct-initializer.cpp +++ b/test/SemaCXX/direct-initializer.cpp @@ -10,7 +10,7 @@ void f() { } class Y { - explicit Y(float); +public: explicit Y(float); }; class X { // expected-note{{candidate constructor (the implicit copy constructor)}} diff --git a/test/SemaCXX/functional-cast.cpp b/test/SemaCXX/functional-cast.cpp index 4e0486c79a..3b088645a6 100644 --- a/test/SemaCXX/functional-cast.cpp +++ b/test/SemaCXX/functional-cast.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // ------------ not interpreted as C-style cast ------------ diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index cff04ab17a..59a8e8c45d 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -194,7 +194,7 @@ somens::a a3 = a2; // expected-error {{no viable conversion}} // typedefs and using declarations. namespace test1 { namespace ns { - class Counter { static int count; }; + class Counter { public: static int count; }; typedef Counter counter; } using ns::counter; diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp index ae77e704f5..50aba47410 100644 --- a/test/SemaCXX/new-delete.cpp +++ b/test/SemaCXX/new-delete.cpp @@ -182,6 +182,7 @@ void f(X8 *x8) { } class X9 { +public: static void operator delete(void*, int); // expected-note {{'operator delete' declared here}} static void operator delete(void*, float); // expected-note {{'operator delete' declared here}} }; @@ -216,6 +217,7 @@ static void* f(void* g) } class X14 { +public: static void operator delete(void*, const size_t); }; diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index 89f181469f..82f000b805 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -88,6 +88,7 @@ enum pr5244_bar class pr5244_baz { +public: pr5244_bar quux; }; diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp index a5dd7e214d..48f641aa99 100644 --- a/test/SemaCXX/static-cast.cpp +++ b/test/SemaCXX/static-cast.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control %s +// RUN: %clang_cc1 -fsyntax-only -verify %s struct A {}; struct B : public A {}; // Single public base. struct C1 : public virtual B {}; // Single virtual base. diff --git a/test/SemaCXX/virtual-override.cpp b/test/SemaCXX/virtual-override.cpp index 6887135826..e07531f643 100644 --- a/test/SemaCXX/virtual-override.cpp +++ b/test/SemaCXX/virtual-override.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x namespace T1 { class A { diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp index a2d3c56501..77961069c5 100644 --- a/test/SemaTemplate/dependent-names.cpp +++ b/test/SemaTemplate/dependent-names.cpp @@ -18,15 +18,18 @@ template<class T> class R : Q<T> {T current;}; namespace test0 { template <class T> class Base { + public: void instance_foo(); static void static_foo(); class Inner { + public: void instance_foo(); static void static_foo(); }; }; template <class T> class Derived1 : Base<T> { + public: void test0() { Base<T>::static_foo(); Base<T>::instance_foo(); @@ -49,6 +52,7 @@ namespace test0 { }; template <class T> class Derived2 : Base<T>::Inner { + public: void test0() { Base<T>::static_foo(); Base<T>::instance_foo(); // expected-error {{call to non-static member function without an object argument}} diff --git a/test/SemaTemplate/instantiate-local-class.cpp b/test/SemaTemplate/instantiate-local-class.cpp index 72ad90a04f..d57ba8a682 100644 --- a/test/SemaTemplate/instantiate-local-class.cpp +++ b/test/SemaTemplate/instantiate-local-class.cpp @@ -13,11 +13,11 @@ template void f0<int>(); // PR5764 namespace PR5764 { - class X { + struct X { template <typename T> void Bar() { typedef T ValueType; - class Y { + struct Y { Y() { V = ValueType(); } ValueType V; diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp index 938c57b75e..f1bdf3e1e6 100644 --- a/test/SemaTemplate/instantiate-member-class.cpp +++ b/test/SemaTemplate/instantiate-member-class.cpp @@ -40,9 +40,9 @@ X<void>::D::E e2; // expected-note{{in instantiation of member class 'X<void>::D // Redeclarations. namespace test1 { template <typename T> struct Registry { - class node; + struct node; static node *Head; - class node { + struct node { node(int v) { Head = this; } }; }; @@ -64,6 +64,7 @@ namespace test2 { template <typename T> class B { class Foo; class Foo { + public: typedef int X; }; typename Foo::X x; diff --git a/test/SemaTemplate/instantiate-member-initializers.cpp b/test/SemaTemplate/instantiate-member-initializers.cpp index e0594347f2..ca94bef226 100644 --- a/test/SemaTemplate/instantiate-member-initializers.cpp +++ b/test/SemaTemplate/instantiate-member-initializers.cpp @@ -21,6 +21,7 @@ B<int> b0; // expected-note {{in instantiation of member function 'B<int>::B' re template <class T> struct AA { AA(int); }; template <class T> class BB : public AA<T> { +public: BB() : AA<T>(1) {} }; BB<int> x; diff --git a/test/SemaTemplate/instantiate-using-decl.cpp b/test/SemaTemplate/instantiate-using-decl.cpp index a4394aa21f..257904490d 100644 --- a/test/SemaTemplate/instantiate-using-decl.cpp +++ b/test/SemaTemplate/instantiate-using-decl.cpp @@ -38,7 +38,7 @@ namespace test1 { using Base2::Visit; }; - class Knot : JoinVisitor<Knot> { + class Knot : public JoinVisitor<Knot> { }; void test() { diff --git a/test/SemaTemplate/qualified-id.cpp b/test/SemaTemplate/qualified-id.cpp index 2e3a826ce8..29eab89d84 100644 --- a/test/SemaTemplate/qualified-id.cpp +++ b/test/SemaTemplate/qualified-id.cpp @@ -21,6 +21,7 @@ namespace test1 { namespace test2 { class Impl { + public: int foo(); }; template <class T> class Magic : public Impl { |