forked from OSchip/llvm-project
parent
2ed6a9d7bd
commit
6bd992d1c3
|
@ -401,6 +401,8 @@ def note_uninit_reference_member : Note<
|
|||
// C++0x auto
|
||||
def err_auto_variable_cannot_appear_in_own_initializer : Error<
|
||||
"variable %0 declared with 'auto' type cannot appear in its own initializer">;
|
||||
def err_illegal_decl_array_of_auto : Error<
|
||||
"'%0' declared as array of 'auto'">;
|
||||
|
||||
// Objective-C++
|
||||
def err_objc_decls_may_only_appear_in_global_scope : Error<
|
||||
|
|
|
@ -498,6 +498,12 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
|
|||
return QualType();
|
||||
}
|
||||
|
||||
if (Context.getCanonicalType(T) == Context.UndeducedAutoTy) {
|
||||
Diag(Loc, diag::err_illegal_decl_array_of_auto)
|
||||
<< getPrintableNameForEntity(Entity);
|
||||
return QualType();
|
||||
}
|
||||
|
||||
if (const RecordType *EltTy = T->getAsRecordType()) {
|
||||
// If the element type is a struct or union that contains a variadic
|
||||
// array, accept it as a GNU extension: C99 6.7.2.1p2.
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: clang-cc -fsyntax-only -verify -std=c++0x
|
||||
|
||||
void f() {
|
||||
int b[5];
|
||||
auto a[5] = b; // expected-error{{'a' declared as array of 'auto'}}
|
||||
}
|
Loading…
Reference in New Issue