Commit ff5034c5 by Giovanni Bajo

nontype3.C: New test.

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

From-SVN: r74701
parent 931a9c05
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> 2003-12-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* g++.dg/warn/noreturn-3.C: Also test instantiation. * g++.dg/warn/noreturn-3.C: Also test instantiation.
......
// { 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" }
...@@ -4,7 +4,7 @@ template<int A::* P> ...@@ -4,7 +4,7 @@ template<int A::* P>
class B class B
{ {
public: public:
static int A::* const p = P; // { dg-error "in-class" } static int A::* const p = P; // { dg-error "" }
}; };
class A class A
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment