зеркало из https://github.com/microsoft/clang-1.git
Don't complain about VLAs of non-POD types when the array type is
dependent. Fixes <rdar://problem/8021385>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104550 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
ceafbdeb93
Коммит
204ce17e0c
|
@ -711,7 +711,8 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
|
|||
if (!getLangOptions().C99) {
|
||||
if (T->isVariableArrayType()) {
|
||||
// Prohibit the use of non-POD types in VLAs.
|
||||
if (!Context.getBaseElementType(T)->isPODType()) {
|
||||
if (!T->isDependentType() &&
|
||||
!Context.getBaseElementType(T)->isPODType()) {
|
||||
Diag(Loc, diag::err_vla_non_pod)
|
||||
<< Context.getBaseElementType(T);
|
||||
return QualType();
|
||||
|
|
|
@ -100,3 +100,17 @@ namespace rdar8020206 {
|
|||
|
||||
template void f<int>(int); // expected-note{{instantiation of}}
|
||||
}
|
||||
|
||||
namespace rdar8021385 {
|
||||
typedef int my_int;
|
||||
struct A { typedef int my_int; };
|
||||
template<typename T>
|
||||
struct B {
|
||||
typedef typename T::my_int my_int;
|
||||
void f0() {
|
||||
int M = 4;
|
||||
my_int a[M]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
|
||||
}
|
||||
};
|
||||
B<A> a;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче