Apparently, it is possible to declare a function returning const void
:
const void foo()
{
}
g++ seems to consider the const
important, because the following code does not compile:
#include <type_traits>
static_assert(std::is_same<void(), const void()>::value, "const matters");
So does const void
have any practical significance?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…