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

            Bug ID: 95564
           Summary: GCC rejects lambda expression with "noexcept(1+1)"
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

This code test.cc

int main(){
    auto a = [ & ] (...) noexcept(1+1) {};
    return 0;
}

$g++-trunk test.cc
test.cc:2:38: error: narrowing conversion of '2' from 'int' to 'bool'
[-Wnarrowing]
    2 |     auto a = [ & ] (...) noexcept(1+1) {};
      |                                  

GCC fails to compile it, while clang, icc, or msvc accept it.

Reply via email to