================ @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -ast-dump %s | FileCheck %s + +// Ensure volatile is preserved during derived-to-base conversion. +namespace PR127683 { + +struct Base { + int Val; +}; + +struct Derived : Base { }; + +volatile Derived Obj; + +// CHECK: `-FunctionDecl {{.*}} test_volatile_store 'void ()' +// CHECK-NEXT: `-CompoundStmt {{.*}} +// CHECK-NEXT: `-BinaryOperator {{.*}} 'volatile int' lvalue '=' +// CHECK-NEXT: |-MemberExpr {{.*}} 'volatile int' lvalue .Val +// CHECK-NEXT: | `-ImplicitCastExpr {{.*}} 'volatile PR127683::Base' lvalue <UncheckedDerivedToBase (Base)> +void test_volatile_store() { + Obj.Val = 0; +} ---------------- AaronBallman wrote:
I'd appreciate a test for volatile read as well as volatile store. https://github.com/llvm/llvm-project/pull/127824 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits