if (T->isReferenceType()) {
// C++ 8.3.2p4: There shall be no ... pointers to references ...
Diag(D.getIdentifierLoc(), diag::err_illegal_decl_pointer_to_reference,
- D.getIdentifier()->getName());
+ D.getIdentifier() ? D.getIdentifier()->getName() : "type name");
D.setInvalidType(true);
T = Context.IntTy;
}
// C++ 8.3.2p4: There shall be no references to references ...
Diag(D.getIdentifierLoc(),
diag::err_illegal_decl_reference_to_reference,
- D.getIdentifier()->getName());
+ D.getIdentifier() ? D.getIdentifier()->getName() : "type name");
D.setInvalidType(true);
T = RT->getReferenceeType();
}
D.setInvalidType(true);
} else if (T->isFunctionType()) {
Diag(D.getIdentifierLoc(), diag::err_illegal_decl_array_of_functions,
- D.getIdentifier()->getName());
+ D.getIdentifier() ? D.getIdentifier()->getName() : "type name");
T = Context.getPointerType(T);
D.setInvalidType(true);
} else if (const ReferenceType *RT = T->getAsReferenceType()) {
// C++ 8.3.2p4: There shall be no ... arrays of references ...
Diag(D.getIdentifierLoc(), diag::err_illegal_decl_array_of_references,
- D.getIdentifier()->getName());
+ D.getIdentifier() ? D.getIdentifier()->getName() : "type name");
T = RT->getReferenceeType();
D.setInvalidType(true);
} else if (const RecordType *EltTy = T->getAsRecordType()) {
--- /dev/null
+// RUN: clang -fsyntax-only -verify -std=c++98 %s
+
+void a (void []()); // expected-error{{'type name' declared as array of functions}}
+void b (void p[]()); // expected-error{{'p' declared as array of functions}}
+void c (int &[]); // expected-error{{'type name' declared as array of references}}
+void d (int &p[]); // expected-error{{'p' declared as array of references}}
+