File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1705,6 +1705,9 @@ bool Compiler<Emitter>::VisitFixedPointUnaryOperator(const UnaryOperator *E) {
17051705template <class Emitter >
17061706bool Compiler<Emitter>::VisitImplicitValueInitExpr(
17071707 const ImplicitValueInitExpr *E) {
1708+ if (DiscardResult)
1709+ return true ;
1710+
17081711 QualType QT = E->getType ();
17091712
17101713 if (OptPrimType T = classify (QT))
Original file line number Diff line number Diff line change @@ -392,3 +392,16 @@ void plainComplex(void) {
392392 _Complex cd ; // all-warning {{_Complex double}}
393393 cd = * (_Complex * )& (struct { double r , i ; }){0.0 , 0.0 }; // all-warning {{_Complex double}}
394394}
395+
396+ /// This test results in an ImplicitValueInitExpr with DiscardResult set.
397+ struct M {
398+ char c ;
399+ };
400+ typedef struct S64 {
401+ struct M m ;
402+ char a [64 ];
403+ } I64 ;
404+
405+ _Static_assert ((((I64 ){}, 1 )), "" ); // all-warning {{left operand of comma operator has no effect}} \
406+ // pedantic-warning {{use of an empty initializer is a C23 extension}} \
407+ // pedantic-warning {{expression is not an integer constant expression; folding it to a constant is a GNU extension}}
You can’t perform that action at this time.
0 commit comments