File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -515,8 +515,8 @@ class InitListChecker {
515
515
uint64_t ElsCount = 1 ;
516
516
// Otherwise try to fill whole array with embed data.
517
517
if (Entity.getKind () == InitializedEntity::EK_ArrayElement) {
518
- ValueDecl *ArrDecl = Entity. getParent ()-> getDecl ();
519
- auto *AType = SemaRef.Context .getAsArrayType (ArrDecl ->getType ());
518
+ auto *AType =
519
+ SemaRef.Context .getAsArrayType (Entity. getParent () ->getType ());
520
520
assert (AType && " expected array type when initializing array" );
521
521
ElsCount = Embed->getDataElementCount ();
522
522
if (const auto *CAType = dyn_cast<ConstantArrayType>(AType))
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -std=c23 -fsyntax-only -verify %s
2
+ // RUN: %clang_cc1 -fsyntax-only -verify -x c++ -Wno-c23-extensions %s
3
+ // expected-no-diagnostics
4
+
5
+ char * p1 = (char []){
6
+ #embed __FILE__
7
+ };
8
+
9
+ int * p2 = (int []){
10
+ #embed __FILE__
11
+ };
12
+
13
+ int * p3 = (int [30 ]){
14
+ #embed __FILE__ limit (30 )
15
+ };
You can’t perform that action at this time.
0 commit comments