Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-101280

Concepts checking for function members can fail with --config=opt

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Compiling this snippet

      namespace {                                                                                          
      struct s1 {                                                                                          
          bool someBool() const {                                                                          
              return true;                                                                                 
          }                                                                                                
      };                                                                                                   
                                                                                                           
      struct s2 {                                                                                          
          bool getSomeBool() const {                                                                       
              return true;                                                                                 
          }                                                                                                
      };                                                                                                   
                                                                                                           
      void testBools(const auto& s) {                                                                      
          static_assert(                                                                                   
              requires { s.someBool; } || requires { s.getSomeBool; },                                     
              "Argument to testBools must support either someBool() or getSomeBool().");                   
      }                                                                                                    
                                                                                                           
      void runTest() {                                                                                     
          testBools(s1{});                                                                                 
          testBools(s2{});                                                                                 
      }                                                                                                    
      }  // namespace
      

      with bazel build --config=opt install-dist-test (I stuck it inside a header file, but it shouldn't matter), this results in

      ERROR: /home/ubuntu/SPM-4041/mongo/src/mongo/db/query/timeseries/BUILD.bazel:12:17: Compiling src/mongo/db/query/timeseries/timeseries_rewrites.cpp failed: (Exit 1): g++ failed: error executing CppCompile command (from target //src/mongo/db/query/timeseries:timeseries_rewrites_with_debug) external/mongo_toolchain_v4/v4/bin/g++ -U_FORTIFY_SOURCE '-std=c++20' -nostdinc++ ... (remaining 333 arguments skipped)
      Execution result: https://sodalite.cluster.engflow.com/actions/executions/ChCgHfMQ0UNCiqLjEC0JFA-PEgdkZWZhdWx0GiUKIJKvNabKZSDCiOkYJh1a0cvfMz42pvOrDjWXcF4YgvBKEM4C
      In file included from src/mongo/db/query/timeseries/timeseries_rewrites.cpp:30:
      src/mongo/db/query/timeseries/timeseries_rewrites.h: In instantiation of 'void mongo::{anonymous}::testBools(const auto:147&) [with auto:147 = mongo::{anonymous}::s1]':
      src/mongo/db/query/timeseries/timeseries_rewrites.h:62:14:   required from here
      src/mongo/db/query/timeseries/timeseries_rewrites.h:57:34: error: static assertion failed: Argument to testBools must support either someBool() or getSomeBool().
         57 |         requires { s.someBool; } || requires { s.getSomeBool; },
            |         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/mongo/db/query/timeseries/timeseries_rewrites.h:57:34: note: '(false || false)' evaluates to false
      src/mongo/db/query/timeseries/timeseries_rewrites.h: In instantiation of 'void mongo::{anonymous}::testBools(const auto:147&) [with auto:147 = mongo::{anonymous}::s2]':
      src/mongo/db/query/timeseries/timeseries_rewrites.h:63:14:   required from here
      src/mongo/db/query/timeseries/timeseries_rewrites.h:57:34: error: static assertion failed: Argument to testBools must support either someBool() or getSomeBool().
      src/mongo/db/query/timeseries/timeseries_rewrites.h:57:34: note: '(false || false)' evaluates to false
      cc1plus: note: unrecognized command-line option '-Wno-interference-size' may have been intended to silence earlier diagnostics
      Target //:install-dist-test failed to build
      Use --verbose_failures to see the command lines of failed build steps.
      INFO: Elapsed time: 81.170s, Critical Path: 35.68s
      INFO: 4 processes: 4 internal.
      ERROR: Build did NOT complete successfully
      

      whereas it succeeds with bazel build install-dist-test.

            Assignee:
            ryan.berryhill@mongodb.com Ryan Berryhill
            Reporter:
            william.qian@mongodb.com William Qian
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: