I am trying to compile my solidity code in remix editor. I keep getting this error "Optimization exception during compilation". I was using solidity version 0.5.2 till day before yesterday. Now, It is not letting me choose the version or higher version which is nightly build.
Issue i am facing turns out to be a browser specific trouble. I was able to deploy my contract successfully from chrome. One mistake I did before backing up my code in Remix IDE in firefox is that I cleared cache and browser history without having a backup. So, I lost the smart contract code. Thankfully, I remembered most of it that I could rewrite the code.
Try to exit, to clear the cache of the browser and restart. Compile without optimizer as first try and, if it is ok, switch on the optimizer.
I currently use 0.5.2 and I did not encounter problems.
I saw something similar using 0.4.24, but it was related to the browser.
(EDIT AFTER COMMENTS FOR REFERENCE OF READERS: it resulted to be exactly that: a browser related problem. Changing the browser solved, but clearing the cache resulted in the loss of the code, not backed-up. There is the suggestion to use the npm remix-ide complete with remixd in order to avoid those occasional loss.)