| 1 |
// { dg-do run { xfail *-*-vxworks* } } |
| 2 |
// { dg-add-options no_pch } |
| 3 |
|
| 4 |
#include <version> |
| 5 |
|
| 6 |
#if __cplusplus >= 202207L |
| 7 |
#ifndef __cpp_lib_ios_noreplace |
| 8 |
# error "Feature-test macro for ios::noreplace missing in <version>" |
| 9 |
#elif __cpp_lib_ios_noreplace < 202207L |
| 10 |
# error "Feature-test macro for ios::noreplace has wrong value in <version>" |
| 11 |
#endif |
| 12 |
#endif |
| 13 |
|
| 14 |
#include <fstream> |
| 15 |
#include <testsuite_hooks.h> |
| 16 |
|
| 17 |
int main() |
| 18 |
{ |
| 19 |
#if __cpp_lib_ios_noreplace |
| 20 |
std::wios::openmode noreplace = std::wios::noreplace; |
| 21 |
#else |
| 22 |
std::wios::openmode noreplace = std::wios::__noreplace; |
| 23 |
#endif |
| 24 |
|
| 25 |
std::wofstream of("noreplace"); |
| 26 |
VERIFY( of.is_open() ); |
| 27 |
of.close(); |
| 28 |
of.open("noreplace", noreplace); |
| 29 |
VERIFY( ! of.is_open() ); |
| 30 |
} |