diff options
author | Giovanni Bajo <giovannibajo@gcc.gnu.org> | 2003-12-16 15:58:38 +0000 |
---|---|---|
committer | Giovanni Bajo <giovannibajo@gcc.gnu.org> | 2003-12-16 15:58:38 +0000 |
commit | ff5034c5be89c496e39b79b52cd496130c51fdb2 (patch) | |
tree | 8758c5f0ba998ff5f0094015c967f7b5cfa60dab /gcc | |
parent | 931a9c05c2c373fc1b7a52e9e2d27718e2395896 (diff) | |
download | gcc-ff5034c5be89c496e39b79b52cd496130c51fdb2.zip gcc-ff5034c5be89c496e39b79b52cd496130c51fdb2.tar.gz gcc-ff5034c5be89c496e39b79b52cd496130c51fdb2.tar.bz2 |
nontype3.C: New test.
* g++.dg/template/nontype3.C: New test.
* g++.dg/template/static2.C: Tweaked the dg-error clause.
From-SVN: r74701
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/nontype3.C | 37 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/static2.C | 2 |
3 files changed, 43 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d685e43..e31d5d5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-12-16 Giovanni Bajo <giovannibajo@gcc.gnu.org> + + * g++.dg/template/nontype3.C: New test. + * g++.dg/template/static2.C: Tweaked the dg-error clause. + 2003-12-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> * g++.dg/warn/noreturn-3.C: Also test instantiation. diff --git a/gcc/testsuite/g++.dg/template/nontype3.C b/gcc/testsuite/g++.dg/template/nontype3.C new file mode 100644 index 0000000..15a204f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/nontype3.C @@ -0,0 +1,37 @@ +// { dg-do compile }
+// Origin: <drow at gcc dot gnu dot org>,
+// <giovannibajo at gcc dot gnu dot org>
+// c++/13243: Template parameters of non integral or enumeration type can't be
+// used for integral constant expressions. ADDR_EXPR and INDIRECT_REF are
+// invalid too.
+
+template <int T> class foo {};
+template <int *T> class bar {};
+
+template <int *PI>
+void dep5(bar<PI> *);
+
+template <int *PI>
+void dep6(bar<PI+1> *); // { dg-error "" "integral or enumeration" }
+
+template <int I>
+void dep7(bar<I+1> *);
+
+template <int *PI>
+void dep8(foo< *PI > *); // { dg-error "" "integral or enumeration" }
+
+template <int PI[1]>
+void dep9(foo< *PI > *); // { dg-error "" "integral or enumeration" }
+
+template <int PI[1]>
+void dep9a(foo< sizeof(*PI) > *);
+
+template <int PI[1]>
+void dep10(foo< PI[0] > *); // { dg-error "" "integral or enumeration" }
+
+template <int I>
+void dep11(foo< *&I > *); // { dg-error "" "constant-expression" }
+
+template <int I>
+void dep12(foo< (&I)[4] > *); // { dg-error "" "constant-expression" }
+
diff --git a/gcc/testsuite/g++.dg/template/static2.C b/gcc/testsuite/g++.dg/template/static2.C index d18c1a7..881f07c 100644 --- a/gcc/testsuite/g++.dg/template/static2.C +++ b/gcc/testsuite/g++.dg/template/static2.C @@ -4,7 +4,7 @@ template<int A::* P> class B { public: - static int A::* const p = P; // { dg-error "in-class" } + static int A::* const p = P; // { dg-error "" } }; class A |