OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [udlit-raw-length.C] - Rev 774

Go to most recent revision | Compare with Previous | Blame | View Log

// { dg-options "-std=c++0x" }
// PR c++/50958

typedef decltype(sizeof(0)) size_type;

constexpr size_type
cstrlen_impl(const char* s, size_type i)
{
  return s[i] ? cstrlen_impl(s, i + 1) : i;
}

constexpr size_type
cstrlen(const char* s)
{
  return s ? cstrlen_impl(s, 0) : throw 0;
}

constexpr size_type
operator "" _lenraw(const char* digits)
{
  return cstrlen(digits);
}

static_assert(123_lenraw == 3, "Ouch");
static_assert(1_lenraw == 1, "Ouch");
static_assert(012_lenraw == 3, "Ouch");
static_assert(0_lenraw == 1, "Ouch");

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.