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

            Bug ID: 41896
           Summary: Bogus "error: no return statement in constexpr
                    function" when void return type is "templated"
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: stephan.bergmann.second...@googlemail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

At least since Clang 5.0 (couldn't easily check back further) and still with
recent Clang trunk:

$ cat test.cc
> #include <type_traits>
> constexpr void f() {}
> constexpr std::enable_if<true, void> g() {}

$ clang++ -fsyntax-only -std=c++17 test.cc 
> test.cc:3:38: error: no return statement in constexpr function
> constexpr std::enable_if<true, void> g() {}
>                                      ^
> 1 error generated.

That is, it doesn't fail for f but only for g, and I don't find anything in
C++17 [dcl.constexpr] that requires a return statement, so I assume the error
is bogus?

(I ran into this in some scenario with GCC libstdc++ after
<https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=a858e2a4ea80631a88a5a1e351389236e3f35bc1>
"Define std::__invoke_r for INVOKE<R>", which added a similar
__can_invoke_as_void<...> __invoke_r(...) to
libstdc++-v3/include/bits/inovke.h.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to