nontype3.C: New test.

* g++.dg/template/nontype3.C: New test.
	* g++.dg/template/static2.C: Tweaked the dg-error clause.

From-SVN: r74701
This commit is contained in:
Giovanni Bajo 2003-12-16 15:58:38 +00:00
parent 931a9c05c2
commit ff5034c5be
3 changed files with 43 additions and 1 deletions

View File

@ -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.

View File

@ -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" }

View File

@ -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