summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/volatile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenCXX/volatile.cpp')
-rw-r--r--test/CodeGenCXX/volatile.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/CodeGenCXX/volatile.cpp b/test/CodeGenCXX/volatile.cpp
index 9c0271b21d..cf49aed4de 100644
--- a/test/CodeGenCXX/volatile.cpp
+++ b/test/CodeGenCXX/volatile.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++98 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++98 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
// Check that IR gen doesn't try to do an lvalue-to-rvalue conversion
@@ -33,3 +33,19 @@ namespace test1 {
*x;
}
}
+
+namespace PR40642 {
+ template <class T> struct S {
+ // CHECK-LABEL: define {{.*}} @_ZN7PR406421SIiE3fooEv(
+ void foo() {
+ // CHECK98-NOT: load volatile
+ // CHECK11: load volatile
+ if (true)
+ reinterpret_cast<const volatile unsigned char *>(m_ptr)[0];
+ // CHECK: }
+ }
+ int *m_ptr;
+ };
+
+ void f(S<int> *x) { x->foo(); }
+}