| 1 |
// { dg-do run } |
| 2 |
|
| 3 |
#include <string> |
| 4 |
|
| 5 |
struct ConfigFile { |
| 6 |
ConfigFile(std::string filename, std::string delimiter) { throw "error"; } |
| 7 |
ConfigFile(std::string filename) {} |
| 8 |
}; |
| 9 |
|
| 10 |
struct Configuration { |
| 11 |
ConfigFile _configFile; |
| 12 |
|
| 13 |
Configuration(const std::string &root, const char *baseName) |
| 14 |
: _configFile(root + baseName, "=") { } |
| 15 |
Configuration(const std::string &root, const char *a, const char *b) |
| 16 |
: _configFile(root + a + b) { } |
| 17 |
}; |
| 18 |
|
| 19 |
|
| 20 |
void test() { |
| 21 |
std::string root("etc"); |
| 22 |
try { |
| 23 |
Configuration config(root, "notthere"); |
| 24 |
} |
| 25 |
catch (...) { |
| 26 |
// exception is thrown, caught here and ignored... |
| 27 |
} |
| 28 |
Configuration config(root, "a", "b"); // ASAN error during constructor here |
| 29 |
} |
| 30 |
|
| 31 |
int main(int argc, const char *argv[]) { |
| 32 |
test(); |
| 33 |
} |