| 1 |
// PR sanitizer/65004 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-fcompare-debug -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all" } |
| 4 |
|
| 5 |
namespace N { |
| 6 |
template <typename Signature> struct function; |
| 7 |
namespace detail { |
| 8 |
namespace function { |
| 9 |
struct vtable_base { }; |
| 10 |
} |
| 11 |
} |
| 12 |
struct function_base { |
| 13 |
detail::function::vtable_base * vtable; |
| 14 |
}; |
| 15 |
template <typename R, typename T0> struct function1 : public function_base { }; |
| 16 |
template <typename R, typename T0> struct function <R (T0)> : public function1 <R, T0> { }; |
| 17 |
} |
| 18 |
namespace Bar { |
| 19 |
typedef N::function <void (const char *)> WarningHandler; |
| 20 |
} |
| 21 |
namespace Foo { |
| 22 |
struct FooRecord { |
| 23 |
virtual ~FooRecord (); |
| 24 |
}; |
| 25 |
struct TestRecord : public FooRecord { |
| 26 |
long x; |
| 27 |
}; |
| 28 |
} |
| 29 |
namespace Foo { |
| 30 |
using Bar::WarningHandler; |
| 31 |
struct FooScanner { |
| 32 |
WarningHandler warnHandler; |
| 33 |
int readByte (); |
| 34 |
long readSignedInteger (); |
| 35 |
}; |
| 36 |
struct FooRecordReader { |
| 37 |
FooScanner & scanner; |
| 38 |
long readSInt (); |
| 39 |
void readTestRecord (TestRecord * recp); |
| 40 |
}; |
| 41 |
inline long FooRecordReader::readSInt () { |
| 42 |
return scanner.readSignedInteger (); |
| 43 |
} |
| 44 |
void FooRecordReader::readTestRecord (TestRecord * recp) { |
| 45 |
int infoByte = scanner.readByte (); |
| 46 |
recp->x = readSInt (); |
| 47 |
} |
| 48 |
} |