repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
c++: robustify testcase [PR109752]
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
cpp1y
/
constexpr-88983.C
blob
9d70601d4277c50a1ebb1a92ea3b122bd2dd1c8b
1
// PR c++/88983
2
// { dg-do compile { target c++14 } }
3
4
constexpr int
5
fn1 (int ay)
6
{
7
switch (ay)
8
{
9
if (1)
10
{
11
case 1:
12
return 1;
13
}
14
else
15
{
16
default:;
17
}
18
}
19
20
return 0;
21
}
22
23
constexpr int
24
fn2 (int ay)
25
{
26
switch (ay)
27
{
28
if (1)
29
{
30
case 1:
31
break;
32
}
33
else
34
{
35
default:;
36
}
37
}
38
39
return 0;
40
}
41
42
constexpr int
43
fn3 (int ay)
44
{
45
int i = 0;
46
while (i++ < 100)
47
{
48
if (i == 1)
49
return 1;
50
switch (ay)
51
{
52
if (1)
53
{
54
case 1:
55
continue;
56
}
57
else
58
{
59
default:;
60
return -1;
61
}
62
}
63
return -1;
64
}
65
66
return -1;
67
}
68
69
static_assert (fn1 (1) == 1, "");
70
static_assert (fn2 (1) == 0, "");
71
static_assert (fn3 (1) == 1, "");