This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/32241] Compiler segmentation fault when trying to call x.~X(); (X &x = f();) in a template



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]