Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/expr/cond16.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
rev | line source |
---|---|
145 | 1 // PR c++/90393 |
2 // { dg-do run } | |
3 | |
4 int c, d; | |
5 | |
6 struct string { | |
7 string(const char *p): s(p) { ++c; } | |
8 ~string() { ++d; } | |
9 string(const string& str): s(str.s) { ++c; } | |
10 const char* s; | |
11 bool empty() const { return !s; } | |
12 }; | |
13 | |
14 string foo() | |
15 { | |
16 string s("foo"); | |
17 return s.empty() ? throw "empty" : s; | |
18 } | |
19 | |
20 int main() | |
21 { | |
22 foo(); | |
23 if (c != d) | |
24 __builtin_abort(); | |
25 } |