Hi,
We have the below code where this warning gets generated.
#include <iostream>
[[noreturn]] inline void
abc () noexcept
{
std::terminate ();
}
using MyNoReturn = void (*) () noexcept;
//using MyNoReturn = std::add_pointer_t<decltype(abc)>; // even this
declaration, instead of the above, gives the same warning
[[noreturn]]
inline void IDontReturn () noexcept
{
std::terminate ();
}
static MyNoReturn gvar {IDontReturn};
[[noreturn]]
inline void
CallIDontReturn () noexcept
{
gvar (); // here is where clang gives
warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
We have the used the below command to compile:
clang++ -std=c++17 -Wall -o runusing usingst.cpp
gcc does not show this warning.
Please let us know how we can use 'using' clause to declare function pointer to
a function that does not return, so that this warning does not show up.
Regards,
Manu
_______________________________________________
cfe-users mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users