/// act of analyzing the enclosing full expression (ActOnFinishFullExpr)
/// if we can determine that the full expression is not instantiation-
/// dependent, then we can entirely avoid its capture.
- ///\r
- /// const int n = 0;\r
- /// [&] (auto x) {\r
- /// (void)+n + x;\r
+ ///
+ /// const int n = 0;
+ /// [&] (auto x) {
+ /// (void)+n + x;
/// };
/// Interestingly, this strategy would involve a capture of n, even though
/// it's obviously not odr-used here, because the full-expression is
/// Before anyone is tempted to implement a strategy for not-capturing 'n',
/// consider the insightful warning in:
/// /cfe-commits/Week-of-Mon-20131104/092596.html
- /// "The problem is that the set of captures for a lambda is part of the ABI\r
- /// (since lambda layout can be made visible through inline functions and the\r
- /// like), and there are no guarantees as to which cases we'll manage to build\r
- /// an lvalue-to-rvalue conversion in, when parsing a template -- some\r
- /// seemingly harmless change elsewhere in Sema could cause us to start or stop\r
- /// building such a node. So we need a rule that anyone can implement and get\r
+ /// "The problem is that the set of captures for a lambda is part of the ABI
+ /// (since lambda layout can be made visible through inline functions and the
+ /// like), and there are no guarantees as to which cases we'll manage to build
+ /// an lvalue-to-rvalue conversion in, when parsing a template -- some
+ /// seemingly harmless change elsewhere in Sema could cause us to start or stop
+ /// building such a node. So we need a rule that anyone can implement and get
/// exactly the same result".
///
void markVariableExprAsNonODRUsed(Expr *CapturingVarExpr) {
inline PartialDiagnostic Sema::PDiag(unsigned DiagID) {
return PartialDiagnostic(DiagID, Context.getDiagAllocator());
}
-\r
-\r
-// This requires the variable to be non-dependent and the initializer\r
-// to not be value dependent.\r
-inline bool IsVariableAConstantExpression(VarDecl *Var, ASTContext &Context) {\r
- const VarDecl *DefVD = 0;\r
- return !isa<ParmVarDecl>(Var) &&\r
- Var->isUsableInConstantExpressions(Context) &&\r
- Var->getAnyInitializer(DefVD) && DefVD->checkInitIsICE(); \r
-}\r
-\r
-// Directly mark a variable odr-used. Given a choice, prefer to use \r
-// MarkVariableReferenced since it does additional checks and then \r
-// calls MarkVarDeclODRUsed.\r
-// If the variable must be captured:\r
-// - if FunctionScopeIndexToStopAt is null, capture it in the CurContext\r
-// - else capture it in the DeclContext that maps to the \r
-// *FunctionScopeIndexToStopAt on the FunctionScopeInfo stack. \r
-inline void MarkVarDeclODRUsed(VarDecl *Var,\r
- SourceLocation Loc, Sema &SemaRef,\r
- const unsigned *const FunctionScopeIndexToStopAt) {\r
- // Keep track of used but undefined variables.\r
- // FIXME: We shouldn't suppress this warning for static data members.\r
- if (Var->hasDefinition(SemaRef.Context) == VarDecl::DeclarationOnly &&\r
- !Var->isExternallyVisible() &&\r
- !(Var->isStaticDataMember() && Var->hasInit())) {\r
- SourceLocation &old = SemaRef.UndefinedButUsed[Var->getCanonicalDecl()];\r
- if (old.isInvalid()) old = Loc;\r
- }\r
- QualType CaptureType, DeclRefType;\r
- SemaRef.tryCaptureVariable(Var, Loc, Sema::TryCapture_Implicit, \r
- /*EllipsisLoc*/ SourceLocation(),\r
- /*BuildAndDiagnose*/ true, \r
- CaptureType, DeclRefType, \r
- FunctionScopeIndexToStopAt);\r
-\r
- Var->markUsed(SemaRef.Context);\r
+
+
+// This requires the variable to be non-dependent and the initializer
+// to not be value dependent.
+inline bool IsVariableAConstantExpression(VarDecl *Var, ASTContext &Context) {
+ const VarDecl *DefVD = 0;
+ return !isa<ParmVarDecl>(Var) &&
+ Var->isUsableInConstantExpressions(Context) &&
+ Var->getAnyInitializer(DefVD) && DefVD->checkInitIsICE();
+}
+
+// Directly mark a variable odr-used. Given a choice, prefer to use
+// MarkVariableReferenced since it does additional checks and then
+// calls MarkVarDeclODRUsed.
+// If the variable must be captured:
+// - if FunctionScopeIndexToStopAt is null, capture it in the CurContext
+// - else capture it in the DeclContext that maps to the
+// *FunctionScopeIndexToStopAt on the FunctionScopeInfo stack.
+inline void MarkVarDeclODRUsed(VarDecl *Var,
+ SourceLocation Loc, Sema &SemaRef,
+ const unsigned *const FunctionScopeIndexToStopAt) {
+ // Keep track of used but undefined variables.
+ // FIXME: We shouldn't suppress this warning for static data members.
+ if (Var->hasDefinition(SemaRef.Context) == VarDecl::DeclarationOnly &&
+ !Var->isExternallyVisible() &&
+ !(Var->isStaticDataMember() && Var->hasInit())) {
+ SourceLocation &old = SemaRef.UndefinedButUsed[Var->getCanonicalDecl()];
+ if (old.isInvalid()) old = Loc;
+ }
+ QualType CaptureType, DeclRefType;
+ SemaRef.tryCaptureVariable(Var, Loc, Sema::TryCapture_Implicit,
+ /*EllipsisLoc*/ SourceLocation(),
+ /*BuildAndDiagnose*/ true,
+ CaptureType, DeclRefType,
+ FunctionScopeIndexToStopAt);
+
+ Var->markUsed(SemaRef.Context);
}
}
-//===--- SemaLambda.h - Lambda Helper Functions --------------*- C++ -*-===//\r
-//\r
-// The LLVM Compiler Infrastructure\r
-//\r
-// This file is distributed under the University of Illinois Open Source\r
-// License. See LICENSE.TXT for details.\r
-//\r
-//===----------------------------------------------------------------------===//\r
-///\r
-/// \file\r
-/// \brief This file provides some common utility functions for processing\r
-/// Lambdas.\r
-///\r
-//===----------------------------------------------------------------------===//\r
-\r
-#ifndef LLVM_CLANG_SEMA_LAMBDA_H\r
-#define LLVM_CLANG_SEMA_LAMBDA_H\r
-#include "clang/AST/ASTLambda.h"\r
-#include "clang/Sema/ScopeInfo.h"\r
-namespace clang {\r
- \r
-\r
-/// \brief Examines the FunctionScopeInfo stack to determine the nearest\r
-/// enclosing lambda (to the current lambda) that is 'capture-capable' for \r
-/// the variable referenced in the current lambda (i.e. \p VarToCapture).\r
-/// If successful, returns the index into Sema's FunctionScopeInfo stack\r
-/// of the capture-capable lambda's LambdaScopeInfo. \r
-/// See Implementation for more detailed comments. \r
-\r
-Optional<unsigned> getStackIndexOfNearestEnclosingCaptureCapableLambda(\r
- ArrayRef<const sema::FunctionScopeInfo *> FunctionScopes,\r
- VarDecl *VarToCapture, Sema &S);\r
-\r
-} // clang\r
-\r
-#endif // LLVM_CLANG_SEMA_LAMBDA_H\r
+//===--- SemaLambda.h - Lambda Helper Functions --------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// \brief This file provides some common utility functions for processing
+/// Lambdas.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_SEMA_LAMBDA_H
+#define LLVM_CLANG_SEMA_LAMBDA_H
+#include "clang/AST/ASTLambda.h"
+#include "clang/Sema/ScopeInfo.h"
+namespace clang {
+
+
+/// \brief Examines the FunctionScopeInfo stack to determine the nearest
+/// enclosing lambda (to the current lambda) that is 'capture-capable' for
+/// the variable referenced in the current lambda (i.e. \p VarToCapture).
+/// If successful, returns the index into Sema's FunctionScopeInfo stack
+/// of the capture-capable lambda's LambdaScopeInfo.
+/// See Implementation for more detailed comments.
+
+Optional<unsigned> getStackIndexOfNearestEnclosingCaptureCapableLambda(
+ ArrayRef<const sema::FunctionScopeInfo *> FunctionScopes,
+ VarDecl *VarToCapture, Sema &S);
+
+} // clang
+
+#endif // LLVM_CLANG_SEMA_LAMBDA_H
NeedQuotes = false;
break;
}
- case DiagnosticsEngine::ak_attr: {\r
- const Attr *At = reinterpret_cast<Attr *>(Val);\r
- assert(At && "Received null Attr object!");\r
- OS << '\'' << At->getSpelling() << '\'';\r
- NeedQuotes = false;\r
- break;\r
- }\r
+ case DiagnosticsEngine::ak_attr: {
+ const Attr *At = reinterpret_cast<Attr *>(Val);
+ assert(At && "Received null Attr object!");
+ OS << '\'' << At->getSpelling() << '\'';
+ NeedQuotes = false;
+ break;
+ }
}
return inherited::TransformLambdaScope(E, NewCallOperator,
InitCaptureExprsAndTypes);
}
- TemplateParameterList *TransformTemplateParameterList(\r
+ TemplateParameterList *TransformTemplateParameterList(
TemplateParameterList *OrigTPL) {
if (!OrigTPL || !OrigTPL->size()) return OrigTPL;
-// RUN: %clang_cc1 -analyzer-config graph-trim-interval=1 -analyzer-max-loop 1 -analyze -analyzer-checker=core,alpha.cplusplus.NewDeleteLeaks -verify %s\r
-// expected-no-diagnostics\r
-\r
-class A {\r
-public:\r
- void f() {};\r
- ~A() {\r
- for (int i=0; i<3; i++)\r
- f();\r
- }\r
-};\r
-\r
-void error() {\r
- A *a = new A();\r
- delete a;\r
-}\r
+// RUN: %clang_cc1 -analyzer-config graph-trim-interval=1 -analyzer-max-loop 1 -analyze -analyzer-checker=core,alpha.cplusplus.NewDeleteLeaks -verify %s
+// expected-no-diagnostics
+
+class A {
+public:
+ void f() {};
+ ~A() {
+ for (int i=0; i<3; i++)
+ f();
+ }
+};
+
+void error() {
+ A *a = new A();
+ delete a;
+}
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y\r
-\r
-// prvalue\r
-void prvalue() {\r
- auto&& x = [](auto a)->void { };\r
- auto& y = [](auto *a)->void { }; // expected-error{{cannot bind to a temporary of type}}\r
-}\r
-\r
-namespace std {\r
- class type_info;\r
-}\r
-\r
-struct P {\r
- virtual ~P();\r
-};\r
-\r
-void unevaluated_operand(P &p, int i) { //expected-note{{declared here}}\r
- // FIXME: this should only emit one error.\r
- int i2 = sizeof([](auto a, auto b)->void{}(3, '4')); // expected-error{{lambda expression in an unevaluated operand}} \\r
- // expected-error{{invalid application of 'sizeof'}}\r
- const std::type_info &ti1 = typeid([](auto &a) -> P& { static P p; return p; }(i));\r
- const std::type_info &ti2 = typeid([](auto) -> int { return i; }(i)); // expected-error{{lambda expression in an unevaluated operand}}\\r
- // expected-error{{cannot be implicitly captured}}\\r
- // expected-note{{begins here}}\r
-}\r
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y
+
+// prvalue
+void prvalue() {
+ auto&& x = [](auto a)->void { };
+ auto& y = [](auto *a)->void { }; // expected-error{{cannot bind to a temporary of type}}
+}
+
+namespace std {
+ class type_info;
+}
+
+struct P {
+ virtual ~P();
+};
+
+void unevaluated_operand(P &p, int i) { //expected-note{{declared here}}
+ // FIXME: this should only emit one error.
+ int i2 = sizeof([](auto a, auto b)->void{}(3, '4')); // expected-error{{lambda expression in an unevaluated operand}} \
+ // expected-error{{invalid application of 'sizeof'}}
+ const std::type_info &ti1 = typeid([](auto &a) -> P& { static P p; return p; }(i));
+ const std::type_info &ti2 = typeid([](auto) -> int { return i; }(i)); // expected-error{{lambda expression in an unevaluated operand}}\
+ // expected-error{{cannot be implicitly captured}}\
+ // expected-note{{begins here}}
+}
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y \r
-\r
-namespace test_factorial {\r
-\r
-auto Fact = [](auto Self, unsigned n) -> unsigned {\r
- return !n ? 1 : Self(Self, n - 1) * n;\r
-};\r
-\r
-auto six = Fact(Fact, 3);\r
-\r
-}\r
-\r
-namespace overload_generic_lambda {\r
- template <class F1, class F2> struct overload : F1, F2 {\r
- using F1::operator();\r
- using F2::operator();\r
- overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }\r
- };\r
-\r
- auto NumParams = [](auto Self, auto h, auto ... rest) -> unsigned {\r
- return 1 + Self(Self, rest...);\r
- };\r
- auto Base = [](auto Self, auto h) -> unsigned {\r
- return 1;\r
- };\r
- overload<decltype(Base), decltype(NumParams)> O(Base, NumParams);\r
- int num_params = O(O, 5, 3, "abc", 3.14, 'a');\r
-}\r
-\r
-\r
-namespace overload_generic_lambda_return_type_deduction {\r
- template <class F1, class F2> struct overload : F1, F2 {\r
- using F1::operator();\r
- using F2::operator();\r
- overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }\r
- };\r
-\r
- auto NumParams = [](auto Self, auto h, auto ... rest) {\r
- return 1 + Self(Self, rest...);\r
- };\r
- auto Base = [](auto Self, auto h) {\r
- return 1;\r
- };\r
- overload<decltype(Base), decltype(NumParams)> O(Base, NumParams);\r
- int num_params = O(O, 5, 3, "abc", 3.14, 'a');\r
-}\r
-\r
-namespace test_standard_p5 {\r
-// FIXME: This test should eventually compile without an explicit trailing return type\r
-auto glambda = [](auto a, auto&& b) ->bool { return a < b; };\r
-bool b = glambda(3, 3.14); // OK\r
-\r
-}\r
-namespace test_deduction_failure {\r
- int test() {\r
- auto g = [](auto *a) { //expected-note{{candidate template ignored}}\r
- return a;\r
- };\r
- struct X { };\r
- X *x;\r
- g(x);\r
- g(3); //expected-error{{no matching function}}\r
- return 0;\r
- }\r
-\r
-}\r
- \r
-namespace test_instantiation_or_sfinae_failure {\r
-int test2() {\r
- {\r
- auto L = [](auto *a) { \r
- return (*a)(a); }; //expected-error{{called object type 'double' is not a function}}\r
- double d;\r
- L(&d); //expected-note{{in instantiation of}}\r
- auto M = [](auto b) { return b; };\r
- L(&M); // ok\r
- }\r
- {\r
- auto L = [](auto *a) ->decltype (a->foo()) { //expected-note2{{candidate template ignored:}}\r
- return (*a)(a); }; \r
- double d;\r
- L(&d); //expected-error{{no matching function for call}} \r
- auto M = [](auto b) { return b; };\r
- L(&M); //expected-error{{no matching function for call}} \r
- \r
- }\r
- return 0;\r
-}\r
-\r
-\r
-}\r
- \r
-namespace test_misc {\r
-auto GL = [](auto a, decltype(a) b) //expected-note{{candidate function}} \r
- -> int { return a + b; };\r
-\r
-void test() {\r
- struct X { };\r
- GL(3, X{}); //expected-error{{no matching function}}\r
-}\r
-\r
-void test2() {\r
- auto l = [](auto *a) -> int { \r
- (*a)(a); return 0; }; //expected-error{{called object type 'double' is not a function}}\r
- l(&l);\r
- double d;\r
- l(&d); //expected-note{{in instantiation of}}\r
-}\r
-\r
-}\r
-\r
-namespace nested_lambdas {\r
- int test() {\r
- auto L = [](auto a) {\r
- return [=](auto b) { \r
- return a + b;\r
- };\r
- };\r
- }\r
- auto get_lambda() {\r
- return [](auto a) {\r
- return a; \r
- };\r
- };\r
- \r
- int test2() {\r
- auto L = get_lambda();\r
- L(3);\r
- }\r
-}\r
-\r
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y
+
+namespace test_factorial {
+
+auto Fact = [](auto Self, unsigned n) -> unsigned {
+ return !n ? 1 : Self(Self, n - 1) * n;
+};
+
+auto six = Fact(Fact, 3);
+
+}
+
+namespace overload_generic_lambda {
+ template <class F1, class F2> struct overload : F1, F2 {
+ using F1::operator();
+ using F2::operator();
+ overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }
+ };
+
+ auto NumParams = [](auto Self, auto h, auto ... rest) -> unsigned {
+ return 1 + Self(Self, rest...);
+ };
+ auto Base = [](auto Self, auto h) -> unsigned {
+ return 1;
+ };
+ overload<decltype(Base), decltype(NumParams)> O(Base, NumParams);
+ int num_params = O(O, 5, 3, "abc", 3.14, 'a');
+}
+
+
+namespace overload_generic_lambda_return_type_deduction {
+ template <class F1, class F2> struct overload : F1, F2 {
+ using F1::operator();
+ using F2::operator();
+ overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }
+ };
+
+ auto NumParams = [](auto Self, auto h, auto ... rest) {
+ return 1 + Self(Self, rest...);
+ };
+ auto Base = [](auto Self, auto h) {
+ return 1;
+ };
+ overload<decltype(Base), decltype(NumParams)> O(Base, NumParams);
+ int num_params = O(O, 5, 3, "abc", 3.14, 'a');
+}
+
+namespace test_standard_p5 {
+// FIXME: This test should eventually compile without an explicit trailing return type
+auto glambda = [](auto a, auto&& b) ->bool { return a < b; };
+bool b = glambda(3, 3.14); // OK
+
+}
+namespace test_deduction_failure {
+ int test() {
+ auto g = [](auto *a) { //expected-note{{candidate template ignored}}
+ return a;
+ };
+ struct X { };
+ X *x;
+ g(x);
+ g(3); //expected-error{{no matching function}}
+ return 0;
+ }
+
+}
+
+namespace test_instantiation_or_sfinae_failure {
+int test2() {
+ {
+ auto L = [](auto *a) {
+ return (*a)(a); }; //expected-error{{called object type 'double' is not a function}}
+ double d;
+ L(&d); //expected-note{{in instantiation of}}
+ auto M = [](auto b) { return b; };
+ L(&M); // ok
+ }
+ {
+ auto L = [](auto *a) ->decltype (a->foo()) { //expected-note2{{candidate template ignored:}}
+ return (*a)(a); };
+ double d;
+ L(&d); //expected-error{{no matching function for call}}
+ auto M = [](auto b) { return b; };
+ L(&M); //expected-error{{no matching function for call}}
+
+ }
+ return 0;
+}
+
+
+}
+
+namespace test_misc {
+auto GL = [](auto a, decltype(a) b) //expected-note{{candidate function}}
+ -> int { return a + b; };
+
+void test() {
+ struct X { };
+ GL(3, X{}); //expected-error{{no matching function}}
+}
+
+void test2() {
+ auto l = [](auto *a) -> int {
+ (*a)(a); return 0; }; //expected-error{{called object type 'double' is not a function}}
+ l(&l);
+ double d;
+ l(&d); //expected-note{{in instantiation of}}
+}
+
+}
+
+namespace nested_lambdas {
+ int test() {
+ auto L = [](auto a) {
+ return [=](auto b) {
+ return a + b;
+ };
+ };
+ }
+ auto get_lambda() {
+ return [](auto a) {
+ return a;
+ };
+ };
+
+ int test2() {
+ auto L = get_lambda();
+ L(3);
+ }
+}
+
// The <> indicate that the pointer is packed, which is required to support
// microsoft layout in 32 bit mode, but not 64 bit mode.
-// CHECK: %struct.A = type <{ i32*, %struct.B }>\r
-// CHECK-X64: %struct.A = type { i32*, %struct.B }\r
+// CHECK: %struct.A = type <{ i32*, %struct.B }>
+// CHECK-X64: %struct.A = type { i32*, %struct.B }
-// RUN: %clang_cc1 -triple i686-pc-win32 -fms-compatibility %s -emit-llvm -o - | FileCheck %s\r
-\r
-#include <stddef.h>\r
-\r
-struct arbitrary_t {} arbitrary;\r
-void *operator new(size_t size, arbitrary_t);\r
-\r
-struct arbitrary2_t {} arbitrary2;\r
-void *operator new[](size_t size, arbitrary2_t);\r
-\r
-namespace PR13164 {\r
- void f() {\r
- // MSVC will fall back on the non-array operator new.\r
- void *a;\r
- int *p = new(arbitrary) int[4];\r
- // CHECK: call i8* @"\01??2@YAPAXIUarbitrary_t@@@Z"(i32 16, %struct.arbitrary_t*\r
- }\r
-\r
- struct S {\r
- void *operator new[](size_t size, arbitrary_t);\r
- };\r
-\r
- void g() {\r
- S *s = new(arbitrary) S[2];\r
- // CHECK: call i8* @"\01??_US@PR13164@@SAPAXIUarbitrary_t@@@Z"(i32 2, %struct.arbitrary_t*\r
- S *s1 = new(arbitrary) S;\r
- // CHECK: call i8* @"\01??2@YAPAXIUarbitrary_t@@@Z"(i32 1, %struct.arbitrary_t*\r
- }\r
-\r
- struct T {\r
- void *operator new(size_t size, arbitrary2_t);\r
- };\r
-\r
- void h() {\r
- // This should still call the global operator new[].\r
- T *t = new(arbitrary2) T[2];\r
- // CHECK: call i8* @"\01??_U@YAPAXIUarbitrary2_t@@@Z"(i32 2, %struct.arbitrary2_t*\r
- }\r
-}\r
+// RUN: %clang_cc1 -triple i686-pc-win32 -fms-compatibility %s -emit-llvm -o - | FileCheck %s
+
+#include <stddef.h>
+
+struct arbitrary_t {} arbitrary;
+void *operator new(size_t size, arbitrary_t);
+
+struct arbitrary2_t {} arbitrary2;
+void *operator new[](size_t size, arbitrary2_t);
+
+namespace PR13164 {
+ void f() {
+ // MSVC will fall back on the non-array operator new.
+ void *a;
+ int *p = new(arbitrary) int[4];
+ // CHECK: call i8* @"\01??2@YAPAXIUarbitrary_t@@@Z"(i32 16, %struct.arbitrary_t*
+ }
+
+ struct S {
+ void *operator new[](size_t size, arbitrary_t);
+ };
+
+ void g() {
+ S *s = new(arbitrary) S[2];
+ // CHECK: call i8* @"\01??_US@PR13164@@SAPAXIUarbitrary_t@@@Z"(i32 2, %struct.arbitrary_t*
+ S *s1 = new(arbitrary) S;
+ // CHECK: call i8* @"\01??2@YAPAXIUarbitrary_t@@@Z"(i32 1, %struct.arbitrary_t*
+ }
+
+ struct T {
+ void *operator new(size_t size, arbitrary2_t);
+ };
+
+ void h() {
+ // This should still call the global operator new[].
+ T *t = new(arbitrary2) T[2];
+ // CHECK: call i8* @"\01??_U@YAPAXIUarbitrary2_t@@@Z"(i32 2, %struct.arbitrary2_t*
+ }
+}
-// This file is purposefully left empty\r
+// This file is purposefully left empty
}
namespace pr12658 {
- class C {\r
- public:\r
- C(int v){}\r
- virtual void f() = 0; // expected-note {{unimplemented pure virtual method 'f' in 'C'}}\r
- };\r
-\r
- void foo( C& c ) {}\r
-\r
- void bar( void ) {\r
- foo(C(99)); // expected-error {{allocating an object of abstract class type 'pr12658::C'}}\r
+ class C {
+ public:
+ C(int v){}
+ virtual void f() = 0; // expected-note {{unimplemented pure virtual method 'f' in 'C'}}
+ };
+
+ void foo( C& c ) {}
+
+ void bar( void ) {
+ foo(C(99)); // expected-error {{allocating an object of abstract class type 'pr12658::C'}}
}
}
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s\r
-\r
-struct Vector {\r
- __vector float xyzw;\r
-} __attribute__((vecreturn)) __attribute__((vecreturn)); // expected-error {{'vecreturn' attribute cannot be repeated}}\r
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s
+
+struct Vector {
+ __vector float xyzw;
+} __attribute__((vecreturn)) __attribute__((vecreturn)); // expected-error {{'vecreturn' attribute cannot be repeated}}
{ }
}
- int array2[] = {\r
- 0, \r
- __if_exists(T::bar) {2, }// expected-warning{{dependent __if_exists declarations are ignored}}\r
- 3\r
- };\r
+ int array2[] = {
+ 0,
+ __if_exists(T::bar) {2, }// expected-warning{{dependent __if_exists declarations are ignored}}
+ 3
+ };
}
template void f(HasFoo); // expected-note{{in instantiation of function template specialization 'f<HasFoo>' requested here}}