Skip to content
Snippets Groups Projects
  • Jö Fahlke's avatar
    d6ec246c
    Be strict about constant expressions · d6ec246c
    Jö Fahlke authored
    The local basis is passed into the local operator kernels as a const
    reference.  That means, its lvalue is not a constant expression.  Would we
    pass it by value, then it's lvalue would be a constant expression (through
    it's rvalue still would not).
    
    Calling a static function of a class throuh an object with the syntax
    ```c++
      lb.size()
    ```
    will evaluate the lvalue of the object.  Since that lvalue is not constant
    when the object was passed by reference, the call cannot be a constant
    expression.
    
    Clang (rightly) complained about this, so write the call as
    ```c++
    LocalBases::size()
    ```
    where a constant expression is required.
    d6ec246c
    History
    Be strict about constant expressions
    Jö Fahlke authored
    The local basis is passed into the local operator kernels as a const
    reference.  That means, its lvalue is not a constant expression.  Would we
    pass it by value, then it's lvalue would be a constant expression (through
    it's rvalue still would not).
    
    Calling a static function of a class throuh an object with the syntax
    ```c++
      lb.size()
    ```
    will evaluate the lvalue of the object.  Since that lvalue is not constant
    when the object was passed by reference, the call cannot be a constant
    expression.
    
    Clang (rightly) complained about this, so write the call as
    ```c++
    LocalBases::size()
    ```
    where a constant expression is required.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.