diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/Wstrict-aliasing-3.C')
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wstrict-aliasing-3.C | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-3.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-3.C new file mode 100644 index 000000000..94c2f4702 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-3.C @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing=2 -O2" } */ + +double x; + +template <typename T> +T *foo(void) +{ + return (T *)&x; /* { dg-warning "strict-aliasing" } */ +} + +template int *foo<int>(void); /* { dg-message "instantiated from here" } */ +template char *foo<char>(void); /* { dg-bogus "instantiated from here" } */ + |