================ @@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -fsyntax-only -verify=c,unsafe -Wdefault-const-init %s +// RUN: %clang_cc1 -fsyntax-only -verify=c,unsafe -Wc++-compat %s +// RUN: %clang_cc1 -fsyntax-only -verify=unsafe %s +// RUN: %clang_cc1 -fsyntax-only -verify=c -Wdefault-const-init -Wno-default-const-init-unsafe %s +// RUN: %clang_cc1 -fsyntax-only -verify=good -Wno-default-const-init-unsafe %s +// RUN: %clang_cc1 -fsyntax-only -verify=cxx -x c++ %s +// good-no-diagnostics + +struct A { int i; }; +struct S{ const int i; }; // unsafe-note 2 {{member 'i' declared 'const' here}} \ + cxx-note 3 {{default constructor of 'S' is implicitly deleted because field 'i' of const-qualified type 'const int' would not be initialized}} +struct T { struct S s; }; // cxx-note {{default constructor of 'T' is implicitly deleted because field 's' has a deleted default constructor}} +struct U { struct S s; const int j; }; ---------------- shafik wrote:
How about ```cpp struct Z { struct A a; const int j; }; ``` To test whether order makes a difference. https://github.com/llvm/llvm-project/pull/137166 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits