Skip to content
  • Kyle Edwards's avatar
    Tests: Fix reliance on undefined behavior of cm::optional · e8bd920d
    Kyle Edwards authored
    The test for cm::optional assumed that *opt would return a reference
    to a non-constructed object if opt.has_value() is false. However, on
    certain systems that build CMake with flags to harden the build,
    this condition aborts rather than returning the invalid reference.
    Fix this by getting the reference only when the cm::optional is
    known to actually have a value.
    
    Fixes: #19964
    e8bd920d