------- Comment #2 from fang at csl dot cornell dot edu 2007-06-08 00:03 ------- reduced test case: ============================== template <typename T> class SimpleStack { public: T& top() { return *ptr; } void pop() { top.~T(); } T *ptr; };
int main(int, char*[]) { SimpleStack<int> stack; stack.pop(); return 0; } ============================== also ICEs 4.0.1 (apple) and 4.2.0. keyword: ice-on-invalid known to fail: 4.0.1, 4.2.0 3.3 (apple) gives: error: destructor name `~int' does not match type `<unknown type>' of expression error: insufficient contextual information to determine type 3.4.6 silently accepts code and compiles. Note: author probably meant "top().~T()" :) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32241