[llvm-bugs] [Bug 52206] New: Clang allow inconsistent deduction for auto return type when using if consteval

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 18 06:26:04 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52206

            Bug ID: 52206
           Summary: Clang allow inconsistent deduction for auto return
                    type when using if consteval
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2b
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hewillk at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

constexpr auto f() {
  if consteval  { return 0;   }
  if !consteval { return 0.0; }
}

int main() {
  auto x = f();
  constexpr auto y = f();
}

https://godbolt.org/z/s5voohMnd

clang accepts this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211018/dbd30c3c/attachment.html>


More information about the llvm-bugs mailing list