There are two issues: First, the compiler is warning about an implicit type conversion in the code. Second, the compiler is treating warnings as errors, causing the build to fail.
The bitset takes a parameter of type unsigned long int, but you are attempting to pass a (signed) short int. You know it will promote the signed value as a two's complement value, and do what you expect, but the compiler is not sure you understand this, and will issue a warning. The most fundamental way to fix this is by type casting, which tells the compiler, explicitly, to make the conversion. There are multiple ways to do this. The simplest and most readable is the older C style cast, which also works in C++:
std::bitset<16> y((unsigned long)c);
An alternative in C++ style:
std::bitset<16> y(static_cast<unsigned long>(c));
More on warnings-as-errors:
A Werror is a compiler flag that treats warnings as errors. While treating warnings as errors can enforce rigor by now letting you proceed without explicitly addressing warnings in some manner, this can also be burdensome when maintaining a large code base that you didn't write. To disable the specific warning-as-error you saw, you'd change it to Wno-error:
-Wno-error=sign-conversion
Note this doesn't disable the warning, it only disables the choice of promoting it to an error that will force the compile to fail. Always review warnings.
You can also disable all warnings-as-errors with -Wno-error
. It's common to disable warnings-as-errors because it can be difficult to work with large bodies of code, often written by others and for less-strict compilers and language versions otherwise, as every warning would need to be satisfied before completing a build. And sometimes you want to build and run existing code without rewriting it to satisfy all the warnings.