compiler-explorer icon indicating copy to clipboard operation
compiler-explorer copied to clipboard

[BUG] /EHc is forced on C++ MSVC

Open gcerretani opened this issue 3 years ago • 1 comments

Describe the bug

Compiler Explorer forces /EHc even if /EHs is explicitly set.

To Reproduce

extern "C" void foo() {
    throw 1;
}

static_assert(noexcept(foo()), "");

Try to compile this on any MSVC with /EHs.

Expected behavior I would expect that /EHs does its job.

Link https://godbolt.org/z/3nhYoezP1

Screenshots n.a.

Desktop n.a.

Additional context The issue can be mitigated by compiling with /EHc- /EHs, as explained in this answer on stackoverflow.

gcerretani avatar Sep 28 '21 07:09 gcerretani

@mattgodbolt If you have any ideas here Im all ears. My personal thought is we shouldn't pass any hidden flags ever. Anything we do by default should so up in the compiler options dialog box so everyone knows they are being set.

timmy-ms avatar Jun 07 '22 18:06 timmy-ms