aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-12.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-12.mm')
-rw-r--r--gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-12.mm51
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-12.mm b/gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-12.mm
new file mode 100644
index 000000000..e08f321e8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-12.mm
@@ -0,0 +1,51 @@
+/* Ensure that typeof()-typed variables inside the @try { } block that
+ "inherit" their EH-volatileness from other variables in the stack frame
+ do not trigger "discards qualifiers from target pointer type" warnings. */
+
+/* { dg-options "-fobjc-exceptions" } */
+/* { dg-do compile } */
+
+typedef volatile int IOSharedLockData;
+
+@interface TestMyTests
+- (void) testSpoon;
+@end
+
+extern void some_func (int *);
+
+@implementation TestMyTests
+- (void) testSpoon {
+ int i = 5;
+
+ do {
+ @try {
+ typeof(i) j = 6;
+ some_func (&j);
+ }
+ @catch (id exc) {
+ @throw;
+ }
+ } while(0);
+
+ do {
+ @try {
+ typeof(i) j = 7;
+ some_func (&j);
+ }
+ @catch (id exc) {
+ @throw;
+ }
+ } while(0);
+
+ do {
+ @try {
+ typeof(i) j = 8;
+ some_func (&j);
+ }
+ @catch (id exc) {
+ @throw;
+ }
+ } while(0);
+
+}
+@end