https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111388

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note variant can still hold neither ...
You might need to add a check for valueless_by_exception here.

But variant::index could be improved to say the only values that are valid is
[0,N],[-1]. and that will remove the check.


Note clang even produces the similar code even with libc++:
        xorl    %eax, %eax
        cmpl    $2, 8(%rdi)
        cmovaeq %rax, %rdi

Just GCC isolates the null pointer access.

Reply via email to