[cfe-dev] QualifiedNameType generated for a dependent type name.

Enea Zaffanella zaffanella at cs.unipr.it
Thu Apr 29 02:02:43 PDT 2010


It seems that clang (r102496) sometimes generates a QualifiedNameType 
(which is meant to be a non-dependent type) when a DependentNameType 
should be expected.

Consider the following program fragment:
template <typename T>
struct S {
   class Inner {};
   Inner a_method();

template <typename T>
typename S<T>::Inner a_function();

template <typename T>
typename S<T>::Inner
S<T>::a_method() {}

Both return types for a_function() and a_method() are type dependent, 
hence they should be encoded by a DependentNameType. However, it seems 
that a QualifiedNameType is generated for a_method().

I don't know how to obtain a detailed description of the AST produced by 
clang ... since AST type nodes seems to be just printed rather than 
dumped. Anyway, even with the -ast-print option, it can be seen that the 
out-of-line definition of a_method() is missing the "typename" keyword.

$ llvm/Debug/bin/clang++ -cc1 -ast-print bug.cc
template <typename T> typename S<T>::Inner a_function();
S<T>::Inner a_method() {

Enea Zaffanella.

More information about the cfe-dev mailing list