Index: include/c_global/cstddef =================================================================== --- include/c_global/cstddef (revision 238557) +++ include/c_global/cstddef (working copy) @@ -57,4 +57,20 @@ } #endif +#if __cplusplus >= 201500L +#define __cpp_lib_support_udls 201605 +namespace std +{ +inline namespace literals +{ +inline namespace support_literals +{ + constexpr size_t + operator""zu(unsigned long long __n) + { return static_cast(__n); } +} +} +} +#endif // C++17 + #endif // _GLIBCXX_CSTDDEF Index: testsuite/18_support/headers/cstddef/literals/types.cc =================================================================== --- testsuite/18_support/headers/cstddef/literals/types.cc (nonexistent) +++ testsuite/18_support/headers/cstddef/literals/types.cc (working copy) @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++17" } +// { dg-do compile } + +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + using namespace std::literals::support_literals; + + static_assert(std::is_same::value, + "1zu is std::size_t"); +} Index: testsuite/18_support/headers/cstddef/literals/values.cc =================================================================== --- testsuite/18_support/headers/cstddef/literals/values.cc (nonexistent) +++ testsuite/18_support/headers/cstddef/literals/values.cc (working copy) @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++1z" } +// { dg-do run } + +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +void +test01() +{ + using namespace std::literals::support_literals; + bool test [[gnu::unused]] = true; + + std::size_t s = 1zu; + std::size_t t = -1zu; + + VERIFY( s == 1 ); + VERIFY( t == std::numeric_limits::max() ); +} + +int +main() +{ + test01(); +}