-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha.cpp
More file actions
34 lines (30 loc) · 709 Bytes
/
Copy patha.cpp
File metadata and controls
34 lines (30 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright Glen Knowles 2022.
// Distributed under the Boost Software License, Version 1.0.
//
// a.cpp - bugs msvc2022
//
// Compile with: Visual C++ 2022 Version 17.1.1
//
// Internal compiler error (compiler file 'ParseTreeActions.cpp', line 4632)
#include <cstddef>
#include <type_traits>
struct Header {
unsigned type;
};
struct Body {
Header hdr;
unsigned a;
unsigned b;
};
struct Util {
template<typename T> requires std::is_same_v<T, Header>
|| std::is_same_v<decltype(T::hdr), Header>
&& (offsetof(T, hdr) == 0)
void unpin(const T *& hdr) const;
};
void test() {
Body val = {};
const Body * ptr = &val;
Util util;
util.unpin(ptr);
}