std::is_literal_type

Header: <type_traits>

std::is_literal_type is a UnaryTypeTrait.

# Declarations

template< class T >
struct is_literal_type;

(since C++11) (deprecated in C++17) (removed in C++20)

# Notes

Only literal types may be used as parameters to or returned from constexpr functions. Only literal classes may have constexpr member functions.

# Example

#include <type_traits>
 
struct A { int m; };
static_assert(std::is_literal_type_v<A> == true);
 
struct B { virtual ~B(); };
static_assert(std::is_literal_type_v<B> == false);
 
int main() {}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 2015C++11T could be an array of incompleteclass type with unknown boundthe behavior isundefined in this case