| 1 |
// P0145R2: Refining Expression Order for C++ |
| 2 |
// { dg-do run { target c++17 } } |
| 3 |
// { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } } |
| 4 |
|
| 5 |
#include <string> |
| 6 |
#define assert(X) if (!(X)) __builtin_abort(); |
| 7 |
|
| 8 |
int main() |
| 9 |
{ |
| 10 |
std::string s = "but I have heard it works even if you don't believe in it" ; |
| 11 |
s.replace(0, 4, "" ).replace( s.find( "even" ), 4, "only" ) |
| 12 |
.replace( s.find( " don't" ), 6, "" ); |
| 13 |
|
| 14 |
assert( s == "I have heard it works only if you believe in it" ) ; |
| 15 |
} |