diff --git a/src/program_builder.cc b/src/program_builder.cc index 11b960d5b7..bee3f299bb 100644 --- a/src/program_builder.cc +++ b/src/program_builder.cc @@ -28,11 +28,10 @@ namespace tint { ProgramBuilder::ProgramBuilder() - : ty(this), ast_(ast_nodes_.Create(Source{})) {} + : ast_(ast_nodes_.Create(Source{})) {} ProgramBuilder::ProgramBuilder(ProgramBuilder&& rhs) - : ty(std::move(rhs.ty)), - types_(std::move(rhs.types_)), + : types_(std::move(rhs.types_)), ast_nodes_(std::move(rhs.ast_nodes_)), sem_nodes_(std::move(rhs.sem_nodes_)), ast_(rhs.ast_), @@ -46,7 +45,6 @@ ProgramBuilder::~ProgramBuilder() = default; ProgramBuilder& ProgramBuilder::operator=(ProgramBuilder&& rhs) { rhs.MarkAsMoved(); AssertNotMoved(); - ty = std::move(rhs.ty); types_ = std::move(rhs.types_); ast_nodes_ = std::move(rhs.ast_nodes_); sem_nodes_ = std::move(rhs.sem_nodes_); diff --git a/src/program_builder.h b/src/program_builder.h index f0ecfb3471..24a018640a 100644 --- a/src/program_builder.h +++ b/src/program_builder.h @@ -477,7 +477,7 @@ class ProgramBuilder { template struct CToAST {}; - ProgramBuilder* builder; + ProgramBuilder* const builder; }; ////////////////////////////////////////////////////////////////////////////// @@ -1101,7 +1101,7 @@ class ProgramBuilder { void WrapInFunction(ast::StatementList stmts); /// The builder types - TypesBuilder ty; + TypesBuilder const ty{this}; protected: /// Asserts that the builder has not been moved.