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

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 788317 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 5/21/2013 8:59:33 AM
Access Restriction Public


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.
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 Macy [MSFT] 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)