mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-30 17:15:33 +08:00
decl.c (make_typename_type): Complain if we don't find a type when trying to make a typename type for a...
* decl.c (make_typename_type): Complain if we don't find a type when trying to make a typename type for a non-template type. From-SVN: r26317
This commit is contained in:
parent
92c7ee702f
commit
11249cf0df
@ -1,3 +1,8 @@
|
||||
1999-04-09 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* decl.c (make_typename_type): Complain if we don't find a type
|
||||
when trying to make a typename type for a non-template type.
|
||||
|
||||
1999-04-09 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* decl.c (start_decl): Pass attributes to grokdeclarator.
|
||||
|
@ -5373,6 +5373,15 @@ make_typename_type (context, name)
|
||||
return TREE_TYPE (t);
|
||||
}
|
||||
}
|
||||
|
||||
/* If the CONTEXT is not a template type, then either the field is
|
||||
there now or its never going to be. */
|
||||
if (!uses_template_parms (context) && !t)
|
||||
{
|
||||
cp_error ("no type named `%#T' in `%#T'", name, context);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
||||
return build_typename_type (context, name, fullname, NULL_TREE);
|
||||
}
|
||||
|
35
gcc/testsuite/g++.old-deja/g++.pt/crash36.C
Normal file
35
gcc/testsuite/g++.old-deja/g++.pt/crash36.C
Normal file
@ -0,0 +1,35 @@
|
||||
// Build don't link:
|
||||
// Origin: Andreas Kloeckner <ak@ixion.net>
|
||||
|
||||
template<class Iterator> struct iterator_traits {
|
||||
typedef typename Iterator::iterator_category
|
||||
iterator_category; // ERROR - no type iterator_category
|
||||
};
|
||||
|
||||
template<class Category>
|
||||
struct iterator {
|
||||
typedef Category iterator_category;
|
||||
};
|
||||
|
||||
|
||||
template <class Iterator>
|
||||
struct reverse_iterator : public
|
||||
iterator<typename iterator_traits<Iterator>::iterator_category> {
|
||||
protected:
|
||||
Iterator current;
|
||||
|
||||
};
|
||||
class tag { };
|
||||
|
||||
template <class T>
|
||||
struct list {
|
||||
template <class Item>
|
||||
struct list_iterator {
|
||||
};
|
||||
|
||||
reverse_iterator<list_iterator<T> > rbegin()
|
||||
{ return reverse_iterator<list_iterator<T> > // ERROR - no type
|
||||
(list_iterator<T>(Head->next())); } // ERROR - instantiated here
|
||||
};
|
||||
|
||||
template class list<int>; // ERROR - instantiated from here
|
Loading…
Reference in New Issue
Block a user