Skip to content

Commit e429d05

Browse files
datumboxfacebook-github-bot
authored andcommitted
Fixing error: "member may not be initialized" due to constexpr at Windows (#48836)
Summary: Fixes #48835 Fixes #48716 Pull Request resolved: #48836 Reviewed By: malfet Differential Revision: D25335829 Pulled By: datumbox fbshipit-source-id: 807182e9afa3bb314dbb85bfcd9589a2c319a7db
1 parent ea2a568 commit e429d05

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

torch/csrc/jit/ir/ir.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,8 +2061,8 @@ TypePtr NamedValue::type() const {
20612061
}
20622062
}
20632063

2064-
constexpr Symbol ProfileOp::Kind;
2065-
constexpr Symbol ProfileOptionalOp::Kind;
2064+
const Symbol ProfileOp::Kind = ::c10::prim::profile;
2065+
const Symbol ProfileOptionalOp::Kind = ::c10::prim::profile_optional;
20662066

20672067
OperatorSet::OperatorSet(std::initializer_list<const char*> sig_literals) {
20682068
for (const char* sig : sig_literals) {

torch/csrc/jit/ir/ir.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ inline const Graph* Value::owningGraph() const {
13261326

13271327
/************* All nodes not required to be defined before Graph **************/
13281328
struct ProfileOp : public Node {
1329-
static constexpr Symbol Kind = ::c10::prim::profile;
1329+
static const Symbol Kind;
13301330
ProfileOp(Graph* graph, std::function<void(std::vector<IValue>&)> callback)
13311331
: Node(graph, ::c10::prim::profile), callback_(std::move(callback)) {}
13321332

@@ -1346,7 +1346,7 @@ struct ProfileOp : public Node {
13461346
};
13471347

13481348
struct TORCH_API ProfileOptionalOp : public Node {
1349-
static constexpr Symbol Kind = ::c10::prim::profile_optional;
1349+
static const Symbol Kind;
13501350
ProfileOptionalOp(
13511351
Graph* graph,
13521352
std::function<void(std::vector<IValue>&)> callback)

torch/csrc/jit/serialization/pickler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class TORCH_API Pickler {
209209
// the left of a '::', its type cannot be deduced by the compiler so one must
210210
// explicitly instantiate the template, i.e. push<int>(int) works, push(int)
211211
// does not)
212-
static constexpr size_t kBufferSize = 256;
212+
static CONSTEXPR_EXCEPT_WIN_CUDA size_t kBufferSize = 256;
213213
template <typename T>
214214
void push(typename std::common_type<T>::type value) {
215215
const char* begin = reinterpret_cast<const char*>(&value);

0 commit comments

Comments
 (0)