re PR c++/13957 (Insufficient diagnostic for dependent expression parsed as non-type but instantiated as type)

PR c++/13957
	* g++.dg/template/non-type-template-argument-1.C,
	g++.dg/template/qualified-id1.C: Update	dg-error marks.
	* g++.dg/template/nontype6.C: New test.

From-SVN: r77091
This commit is contained in:
Giovanni Bajo 2004-02-02 01:11:03 +00:00
parent 84b683c166
commit 9febc4e8de
4 changed files with 30 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2004-02-01 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/13957
* g++.dg/template/non-type-template-argument-1.C,
g++.dg/template/qualified-id1.C: Update dg-error marks.
* g++.dg/template/nontype6.C: New test.
2004-02-01 Roger Sayle <roger@eyesopen.com>
* gcc.dg/builtins-1.c: Also test for __builtin_signbit{,f,l}.

View File

@ -6,7 +6,7 @@ template <bool> struct C {};
template <typename T> struct D
{
C<T::X> c; // { dg-error "names a type" }
C<T::X> c; // { dg-error "parsed as a non-type|if a type is meant" }
};
D<B> d; // { dg-error "" }
D<B> d; // { dg-error "instantiated from here" }

View File

@ -0,0 +1,19 @@
// { dg-do compile }
// Origin: <v dot haisman at sh dot cvut dot cz>
// PR c++/13957: Improved error message for type in template (when non-type
// is expected).
template <class T>
struct A
{
typedef int type;
};
template <class T>
void func(void)
{
(void)A<T>::type(); // { dg-error "if a type is meant" }
// { dg-error "parsed as a non-type" "" { target *-*-* } 15 }
}
template void func<float>(void); // { dg-error "instantiated from here" }

View File

@ -16,8 +16,8 @@ template <> struct A::B<false> {};
template <typename T> void foo()
{
T::C (); // { dg-error "names a type" "" }
T::template B<false>(); // { dg-error "names a type" "" }
T::C (); // { dg-error "parsed as a non-type|if a type is meant" "" }
T::template B<false>(); // { dg-error "parsed as a non-type|if a type is meant" "" }
}
void bar()