You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
424 B
C++

#ifdef __clang__
#include <stdio.h>
#else
// GCC 4.8 doesn't know that puts() is nothrow; we must give it a hint.
extern void puts(const char*) noexcept(true);
#endif
#include "auto.h"
extern void foo();
int main() {
if (true) {
Auto(puts("two"));
puts("one"); // compiler knows this doesn't throw
}
if (true) {
Auto(puts("three"));
foo(); // might throw an exception
}
}