# Microsoft (R) Optimizing Compiler Has Stopped Working

This topic is 2218 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello,

I have just received the error in the title when trying to compile the following code

auto ExtractString = [&](string& dest, char source, FileSection& currentFileSection, FileSection nextFileSection = END_OF_HEADER)
{ ... };

Just for context, I am writing a custom file format parser.

Am I just hosed here, or is there some way to work around a broken compiler?

Thanks and best,

Dave

##### Share on other sites
Check your lambda capture syntax (the [&] stuff).

Alternatively, use a conventional function (and its pointer) in place of the lambda expression.

##### Share on other sites
What is the minimal source file that reproduces the error?

For example, I get "error C3486: a parameter for a lambda cannot have a default argument" with the following code:
 #include <string> using std::string; enum FileSection { START_OF_HEADER, END_OF_HEADER }; int main() { auto ExtractString = [&](string& dest, char source, FileSection& currentFileSection, FileSection nextFileSection = END_OF_HEADER) { }; std::string string; FileSection current = START_OF_HEADER; ExtractString(string, 'a', current); } 
Some light Googling suggests this is actually compliant with the standard and not an incomplete implementation.

It would be interesting to know what changes you have to make to generate the crash. Even if it is not legal code, it shouldn't crash the compiler so you should look into reporting this.

##### Share on other sites
While I have found sporadically code that could crash an MSVC compiler in practically every instance it was rather clear that the code was wrong and needed to be fixed anyway (admittedly, that would have been easier with a proper error message).

That said, such cases have always been extremely rare for me. Infrequently the compiler crashes, but usually that is fixed by just trying again or doing a clean first. There was one instance where I had to manually (clean or rebuild explicitly did not do the job) delete all intermediate files to get things working again, but that was back in MSVC 2003.

##### Share on other sites
Yeah, I tanked it once myself, though now I can't remember what it was I did. (It was something really crazy that came out of a typo.)

Your compiler is fine. It's just a microsoft product. Edited by Khatharr

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
14
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013643
×