[cfe-dev] Doubts regarding CXXPseudoDestructorExpr.
Enea Zaffanella
zaffanella at cs.unipr.it
Sat Apr 24 03:30:45 PDT 2010
Hello.
When compiling the following program with clang:
=============================
template <typename U>
struct S {
typedef U my_type;
};
template <typename U>
struct T {
void foo(typename S<U>::my_type* x) {
typedef typename S<U>::my_type Type;
x->Type::~Type(); // OK
x->~Type(); // OK
x->S<U>::my_type::~my_type(); // Error (why?)
x->S<U>::~my_type(); // Error (why?)
x->Type::~my_type(); // Crash.
}
};
int main() {
T<int> t;
t.foo(0);
return 0;
}
=============================
we obtain the two errors and then a crash:
=============================
$ llvm/Debug/bin/clang++ -fsyntax-only pseudo.cc
pseudo.cc:12:10: error: 'U' does not refer to a value
x->S<U>::my_type::~my_type(); // Error (why?)
^
pseudo.cc:6:20: note: declared at
template <typename U>
^
pseudo.cc:13:10: error: 'U' does not refer to a value
x->S<U>::~my_type(); // Error (why?)
^
pseudo.cc:6:20: note: declared at
template <typename U>
^
[...snip...]
1. <eof> parser at end of file
2. pseudo.cc:8:8: instantiating function definition 'T<int>::foo'
clang: error: compiler command failed due to signal 11 (use -v to see
invocation)
=============================
Apart from the crash, we would like to know whether or not the two
errors are meant to be there (we tried other compilers ... but each one
seems to have its own view of the matter).
As a side note, when looking into the definition of AST node
CXXPseudoDestructorExpr, we were surprised to see so many data members
(Qualifier, ScopeType and DestroyedType) and were wondering whether or
not all of this could be replaced by a single TypeSourceInfo, possibly
containing a QualifiedNameType or a DependentNameType encoding the
optional (dependent) name qualifier.
Cheers,
Enea Zaffanella.
More information about the cfe-dev
mailing list