https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68281
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- See C++14 8.5 [dcl.init] p12: If an indeterminate value is produced by an evaluation, the behavior is undefined except in the following cases: [... various cases involving unsigned char ...] so you should add the if (present) check before the assignment that uses the evaluation of value.