Home Dashboard Directory Help
Search

[Codename Milan] assignment-expression with initializer-clause is parsed incorrectly by Ivan Sorokin


Status: 

Closed
 as Won't Fix Help for as Won't Fix


1
0
Sign in
to vote
Type: Bug
ID: 788317
Opened: 5/21/2013 8:59:33 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

November CTP of MSVC incorrectly parses assignment-expression with initializer-clause. According to example in [expr.ass]p9

int main()
{
    int a, b;
    a = {1} = b; // syntax error
}

Assignment "a = {1} = b" should be a syntax error, but MSVC accepts this code without a error.
Details
Sign in to post a comment.
Posted by Microsoft on 6/2/2014 at 3:06 PM
Hi Ivan,

While this code should indeed be treated by the compiler as an error, we do already emit a warning so that the developer is drawn attention to it. In the context of other, more severe bugs, we have decided against specifically fixing this one for now. We are, however, in the process of improving the compiler's diagnostics, and this missing error might be addressed in that effort.

Karl Niu
Visual C++ Team
Posted by Microsoft on 5/23/2013 at 1:51 AM
Hi Ivan Sorokin, thanks for your response. Your issue has been routed to the appropriate VS development team for investigation.
Posted by Ivan Sorokin on 5/23/2013 at 1:12 AM
C4700 is a warning, not a error. Compiler should give syntax error on this code (as IntelliSense does).

Here is test case without a warning:

int main()
{
    int a = 0, b = 0;
    a = {1} = b; // syntax error
}
Posted by Microsoft on 5/22/2013 at 9:43 PM
Hi Ivan Sorokin, thank you for submitting feedback on Visual Studio and .NET Framework. It seems like i can't repro this issue in my case, i met error C4700:uninitialized local variable 'b' used and IntelliSense:expected an expression errors. I have tried this issue on VS 2012 Update 2 in windows 7 and on VS 2012 Update 3 RC in windows 8.
Posted by Microsoft on 5/22/2013 at 12:52 PM
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.