File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2795,6 +2795,10 @@ bool Converter::VisitInitListExpr(clang::InitListExpr *expr) {
27952795 StrCat (token::kComma );
27962796 }
27972797 } else {
2798+ if (IsInitExprOfStringLiteral (expr)) {
2799+ Convert (expr->getInit (0 )->IgnoreParenImpCasts ());
2800+ return false ;
2801+ }
27982802 PushBracket bracket (*this );
27992803 for (auto *init : expr->inits ()) {
28002804 ConvertVarInit (init->getType (), init);
Original file line number Diff line number Diff line change @@ -60,5 +60,12 @@ fn main_0() -> i32 {
6060 let _str: Ptr < u8 > = ( immutable_empty_arr. as_pointer ( ) as Ptr < u8 > ) ;
6161 foo_const_1 ( _str)
6262 } ) ;
63+ let inited_through_init_list: Value < Box < [ u8 ] > > = Rc :: new ( RefCell :: new ( Box :: < [ u8 ] > :: from (
64+ b"papanasi cu smantana\0 " . as_slice ( ) ,
65+ ) ) ) ;
66+ ( {
67+ let _str: Ptr < u8 > = ( inited_through_init_list. as_pointer ( ) as Ptr < u8 > ) ;
68+ foo_const_1 ( _str)
69+ } ) ;
6370 return 0 ;
6471}
Original file line number Diff line number Diff line change @@ -91,5 +91,12 @@ fn main_0() -> i32 {
9191 let _str: Ptr < u8 > = ( immutable_empty_arr. as_pointer ( ) as Ptr < u8 > ) ;
9292 foo_const_1 ( _str)
9393 } ) ;
94+ let inited_through_init_list: Value < Box < [ u8 ] > > = Rc :: new ( RefCell :: new ( Box :: < [ u8 ] > :: from (
95+ b"papanasi cu smantana\0 " . as_slice ( ) ,
96+ ) ) ) ;
97+ ( {
98+ let _str: Ptr < u8 > = ( inited_through_init_list. as_pointer ( ) as Ptr < u8 > ) ;
99+ foo_const_1 ( _str)
100+ } ) ;
94101 return 0 ;
95102}
You can’t perform that action at this time.
0 commit comments