Search

Random errors caused by syntax error by Asylum2010

Closed
as Deferred Help for as Deferred

1
0
Sign in
to vote
Type: Bug
ID: 772089
Opened: 11/24/2012 8:08:41 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug

// The following program generates random errors in STL headers,
// or even internal compiler error.

// The problem is caused by not putting pharenteses after the destructor call.

#include <iostream>

template <typename T>
class myvector
{
private:
    T*        mydata;
    size_t    mysize;

public:
    void pop_back()
    {
        --mysize;
        (mydata + mysize)->~T;    // <--- here's the error
    }
};

int main()
{
    myvector<int> v1;

    v1.pop_back();

    system("pause");
    return 0;
}
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

Visual Studio 2012

Steps to reproduce

- compile program

Product Language

English

Operating System

Windows 7 SP1

Operating System Language

English

Actual results

Random errors in STL headers, sometimes internal compiler error. Depends on which headers you include.

Expected results

Compiler should notice the missing () after the destructor call.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 11/25/2012 at 8:22 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 11/24/2012 at 8:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.