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] - Blame information for rev 774

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-options "-std=c++0x" }
2
// PR c++/50958
3
 
4
typedef decltype(sizeof(0)) size_type;
5
 
6
constexpr size_type
7
cstrlen_impl(const char* s, size_type i)
8
{
9
  return s[i] ? cstrlen_impl(s, i + 1) : i;
10
}
11
 
12
constexpr size_type
13
cstrlen(const char* s)
14
{
15
  return s ? cstrlen_impl(s, 0) : throw 0;
16
}
17
 
18
constexpr size_type
19
operator "" _lenraw(const char* digits)
20
{
21
  return cstrlen(digits);
22
}
23
 
24
static_assert(123_lenraw == 3, "Ouch");
25
static_assert(1_lenraw == 1, "Ouch");
26
static_assert(012_lenraw == 3, "Ouch");
27
static_assert(0_lenraw == 1, "Ouch");

powered by: WebSVN 2.1.0

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