view gcc/testsuite/g++.dg/ext/char8_t-limits-1.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

// Test for unsignedness and that the max limit of char8_t is at least 0xFF
// when -fchar8_t is enabled.
// { dg-do compile }
// { dg-options "-std=c++17 -fchar8_t" }

static_assert(u8'\xFF' == 0xFF, "Error");
static_assert(u8"\xFF"[0] == 0xFF, "Error");
static_assert(char8_t(-1) >= 0, "Error");
static_assert(char8_t{-1} >= 0, "Error"); // { dg-error "narrowing conversion of .-1. from .int. to .char8_t." "char8_t" }