File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 22
22
#include " clang/AST/Attr.h"
23
23
#include " clang/AST/RecordLayout.h"
24
24
#include " clang/AST/StmtVisitor.h"
25
+ #include " clang/AST/Type.h"
25
26
#include " clang/Basic/Builtins.h"
26
27
#include " llvm/ADT/STLExtras.h"
27
28
#include " llvm/ADT/Sequence.h"
@@ -1358,6 +1359,8 @@ class ConstExprEmitter :
1358
1359
}
1359
1360
1360
1361
llvm::Constant *VisitStringLiteral (StringLiteral *E, QualType T) {
1362
+ if (!isa<ConstantArrayType>(T.getDesugaredType (CGM.getContext ())))
1363
+ return nullptr ;
1361
1364
// This is a string literal initializing an array in an initializer.
1362
1365
return CGM.GetConstantArrayFromStringLiteral (E);
1363
1366
}
Original file line number Diff line number Diff line change @@ -424,6 +424,8 @@ namespace DR2126 {
424
424
// CHECK: @_ZN33ClassTemplateWithStaticDataMember3useE ={{.*}} constant ptr @_ZGRN33ClassTemplateWithStaticDataMember1SIvE1aE_
425
425
// CHECK: @_ZGRN39ClassTemplateWithHiddenStaticDataMember1SIvE1aE_ = linkonce_odr hidden constant i32 5, comdat
426
426
// CHECK: @_ZN39ClassTemplateWithHiddenStaticDataMember3useE ={{.*}} constant ptr @_ZGRN39ClassTemplateWithHiddenStaticDataMember1SIvE1aE_
427
+ // CHECK: @.str.[[STR:[0-9]+]] ={{.*}} constant [9 x i8] c"12345678\00"
428
+ // CHECK-NEXT: @e = global %struct.PR69979 { ptr @.str.[[STR]] }
427
429
// CHECK: @_ZGRZN20InlineStaticConstRef3funEvE1i_ = linkonce_odr constant i32 10, comdat
428
430
// CHECK20: @_ZZN12LocalVarInit4dtorEvE1a = internal constant {{.*}} i32 103
429
431
@@ -632,6 +634,10 @@ struct X {
632
634
const char *f () { return &X::p; }
633
635
}
634
636
637
+ struct PR69979 {
638
+ const char (&d)[9];
639
+ } e {" 12345678" };
640
+
635
641
// VirtualMembers::TemplateClass::templateMethod() must be defined in this TU,
636
642
// not just declared.
637
643
// CHECK: define linkonce_odr void @_ZN14VirtualMembers13TemplateClassIiE14templateMethodEv(ptr {{[^,]*}} %this)
You can’t perform that action at this time.
0 commit comments