Index: src/Validate/CompoundLiteral.cpp
===================================================================
--- src/Validate/CompoundLiteral.cpp	(revision 2cf3b87c585cfb9fa6dcb8ea9d77ad576fccea3b)
+++ src/Validate/CompoundLiteral.cpp	(revision 2cf3b87c585cfb9fa6dcb8ea9d77ad576fccea3b)
@@ -0,0 +1,70 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// CompoundLiteral.cpp -- Use variables to implement compound literals.
+//
+// Author           : Andrew Beach
+// Created On       : Mon Nov 15 16:33:00 2021
+// Last Modified By : Andrew Beach
+// Last Modified On : Mon Nov 16  9:47:00 2021
+// Update Count     : 0
+//
+
+#include "CompoundLiteral.hpp"
+
+#include "AST/Decl.hpp"
+#include "AST/Expr.hpp"
+#include "AST/Pass.hpp"
+#include "AST/TranslationUnit.hpp"
+#include "Common/UniqueName.h"
+
+namespace Validate {
+
+namespace {
+
+struct CompoundLiteral final :
+		public ast::WithDeclsToAdd<>,
+		public ast::WithVisitorRef<CompoundLiteral> {
+	ast::Storage::Classes storageClasses;
+
+	void previsit( const ast::ObjectDecl * decl );
+	const ast::Expr * postvisit( const ast::CompoundLiteralExpr * expr );
+};
+
+void CompoundLiteral::previsit( const ast::ObjectDecl * decl ) {
+	storageClasses = decl->storage;
+}
+
+const ast::Expr * CompoundLiteral::postvisit(
+		const ast::CompoundLiteralExpr * expr ) {
+	static UniqueName litName( "_compLit" );
+
+	// Transform: [storageClasses] ... (struct S){...} ...
+	// Into:      [storageClasses] struct S _compLit = {...}; / ... temp ...
+	ast::ObjectDecl * temp = new ast::ObjectDecl(
+		expr->location,
+		litName.newName(),
+		expr->result,
+		expr->init,
+		storageClasses
+		);
+	declsToAddBefore.push_back( temp );
+	return new ast::VariableExpr( expr->location, temp );
+}
+
+} // namespace
+
+void handleCompoundLiterals( ast::TranslationUnit & translationUnit ) {
+	ast::Pass<CompoundLiteral>::run( translationUnit );
+}
+
+} // namespace Validate
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Validate/CompoundLiteral.hpp
===================================================================
--- src/Validate/CompoundLiteral.hpp	(revision 2cf3b87c585cfb9fa6dcb8ea9d77ad576fccea3b)
+++ src/Validate/CompoundLiteral.hpp	(revision 2cf3b87c585cfb9fa6dcb8ea9d77ad576fccea3b)
@@ -0,0 +1,33 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// CompoundLiteral.hpp -- Use variables to implement compound literals.
+//
+// Author           : Andrew Beach
+// Created On       : Mon Nov 15 16:37:00 2021
+// Last Modified By : Andrew Beach
+// Last Modified On : Mon Nov 15 17:56:00 2021
+// Update Count     : 0
+//
+
+#pragma once
+
+namespace ast {
+	class TranslationUnit;
+}
+
+namespace Validate {
+
+/// Use variables to implement compound literals.
+void handleCompoundLiterals( ast::TranslationUnit & translationUnit );
+
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Validate/module.mk
===================================================================
--- src/Validate/module.mk	(revision ce36b5519dcfbed597a596a468dc1684221e78ab)
+++ src/Validate/module.mk	(revision 2cf3b87c585cfb9fa6dcb8ea9d77ad576fccea3b)
@@ -16,4 +16,6 @@
 
 SRC_VALIDATE = \
+	Validate/CompoundLiteral.cpp \
+	Validate/CompoundLiteral.hpp \
 	Validate/HandleAttributes.cc \
 	Validate/HandleAttributes.h \
