Fixes a crash (<rdar://problem/
11067144>), and generally seems to improve
recovery in other cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161474
91177308-0d34-0410-b5e6-
96231b3b80d8
AttributeList *Attr) {
assert(EnclosingDecl && "missing record or interface decl");
- // If the decl this is being inserted into is invalid, then it may be a
- // redeclaration or some other bogus case. Don't try to add fields to it.
- if (EnclosingDecl->isInvalidDecl())
- return;
-
// If this is an Objective-C @implementation or category and we have
// new fields here we should reset the layout of the interface since
// it will now change.
sizeof(zend_module_entry)
};
+// <rdar://problem/11067144>
+typedef int (FunctionType)(int *value);
+typedef struct {
+ UndefinedType undef; // expected-error {{unknown type name 'UndefinedType'}}
+ FunctionType fun; // expected-error {{field 'fun' declared as a function}}
+} StructType;
+void f(StructType *buf) {
+ buf->fun = 0;
+}
basic_string(aT*);
};
-struct runtime_error{ // expected-note{{candidate constructor}}
- runtime_error( // expected-note{{candidate constructor}}
+struct runtime_error{
+ runtime_error(
basic_string<char> struct{ // expected-error {{cannot combine with previous 'type-name' declaration specifier}}
a(){ // expected-error {{requires a type specifier}}
- runtime_error(0); // expected-error{{no matching conversion for functional-style cast from 'int' to 'runtime_error'}}
+ runtime_error(0);
}
}
);
// <rdar://problem/8308215>: don't crash.
// Lots of questionable recovery here; errors can change.
namespace test3 {
- class A : public std::exception {}; // expected-error {{undeclared identifier}} expected-error {{expected class name}} expected-note 3 {{candidate}} expected-note {{passing argument}}
+ class A : public std::exception {}; // expected-error {{undeclared identifier}} expected-error {{expected class name}} expected-note 2 {{candidate}}
class B : public A {
public:
B(const String& s, int e=0) // expected-error {{unknown type name}}
: A(e), m_String(s) , m_ErrorStr(__null) {} // expected-error {{no matching constructor}} expected-error {{does not name}}
B(const B& e)
- : A(e), m_String(e.m_String), m_ErrorStr(__null) { // expected-error {{no viable conversion}} expected-error {{does not name}}
+ : A(e), m_String(e.m_String), m_ErrorStr(__null) { // expected-error {{does not name}} expected-error {{no member named 'm_String' in 'test3::B'}}
}
};
}