Commit 68ea098a by Nathan Sidwell Committed by Nathan Sidwell

cp: * pt.c (instantiate_class_template): Set location before substuting bases.

cp:	* pt.c (instantiate_class_template): Set location before
	substuting bases.
testsuite:
	* g++.dg/template/error2.C: New test.
	* g++.dg/lookup/using7.C: Adjust errors
	* g++.old-deja/g++.pt/crash36.C: Likewise.
	* g++.old-deja/g++.pt/derived3.C: Likewise.

From-SVN: r70476
parent 4f7847ca
2003-08-15 Nathan Sidwell <nathan@codesourcery.com> 2003-08-15 Nathan Sidwell <nathan@codesourcery.com>
* pt.c (instantiate_class_template): Set location before
substuting bases.
* decl.c (make_typename_type): Use my_friendly_assert. * decl.c (make_typename_type): Use my_friendly_assert.
* pt.c (tsubst_aggr_type): Rearrange context substitution. * pt.c (tsubst_aggr_type): Rearrange context substitution.
......
...@@ -5137,6 +5137,10 @@ instantiate_class_template (tree type) ...@@ -5137,6 +5137,10 @@ instantiate_class_template (tree type)
SET_CLASSTYPE_INTERFACE_UNKNOWN (type); SET_CLASSTYPE_INTERFACE_UNKNOWN (type);
} }
/* Set the input location to the template definition. This is needed
if tsubsting causes an error. */
input_location = DECL_SOURCE_LOCATION (TYPE_NAME (pattern));
TYPE_HAS_CONSTRUCTOR (type) = TYPE_HAS_CONSTRUCTOR (pattern); TYPE_HAS_CONSTRUCTOR (type) = TYPE_HAS_CONSTRUCTOR (pattern);
TYPE_HAS_DESTRUCTOR (type) = TYPE_HAS_DESTRUCTOR (pattern); TYPE_HAS_DESTRUCTOR (type) = TYPE_HAS_DESTRUCTOR (pattern);
TYPE_HAS_NEW_OPERATOR (type) = TYPE_HAS_NEW_OPERATOR (pattern); TYPE_HAS_NEW_OPERATOR (type) = TYPE_HAS_NEW_OPERATOR (pattern);
......
2003-08-15 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/template/error2.C: New test.
* g++.dg/lookup/using7.C: Adjust errors
* g++.old-deja/g++.pt/crash36.C: Likewise.
* g++.old-deja/g++.pt/derived3.C: Likewise.
2003-08-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2003-08-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.c-torture/execute/builtins/lib/strcat.c: New. * gcc.c-torture/execute/builtins/lib/strcat.c: New.
......
...@@ -4,7 +4,7 @@ template <typename T, bool=T::X> struct A ...@@ -4,7 +4,7 @@ template <typename T, bool=T::X> struct A
}; };
template <typename T> struct B : A<T> template <typename T> struct B : A<T>
{ { // { dg-error "" }
using A<T>::i; // { dg-error "" } using A<T>::i; // { dg-error "" }
}; };
......
// { dg-do compile }
// Copyright (C) 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Aug 2003 <nathan@codesourcery.com>
// instantiated from did not indicate the nested class
template<class T> struct X
{
T m; // { dg-error "" "" }
};
template<class T >
struct Derived
{
class Nested : public X<T>
{ // { dg-error "instantiated"
};
Nested m; // { dg-error "instantiated" "" }
void Foo ();
};
void Foo (Derived<void> &x)
{
x.Foo (); // { dg-error "instantiated" "" }
}
...@@ -14,7 +14,7 @@ struct iterator { ...@@ -14,7 +14,7 @@ struct iterator {
template <class Iterator> template <class Iterator>
struct reverse_iterator : public struct reverse_iterator : public
iterator<typename iterator_traits<Iterator>::iterator_category> { iterator<typename iterator_traits<Iterator>::iterator_category> { // { dg-error "" } no type iterator_category
protected: protected:
Iterator current; Iterator current;
......
// { dg-do assemble } // { dg-do compile }
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc. // by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
// Copyright (C) 1999, 2002 Free Software Foundation // Copyright (C) 1999, 2002 Free Software Foundation
template<class T> template<class T>
class X { class X {
class Y : public T {}; class Y : public T
Y y; // { dg-error "" } invalid base type { // { dg-error "base type .* fails to be" "" }
};
Y y; // { dg-error "instantiated" "" }
}; };
int main() { int main() {
X<int> x; // { dg-error "" } instantiated X<int> x; // { dg-error "instantiated" "" }
} }
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