Prevent changing Reference<> address

Reactor's Reference<> class represents a C++-like reference. It can be
constructed from another reference, which creates a shallow copy, or it
can be assigned another reference, which is a deep copy, but it cannot
be assigned a new address. To enforce this, the address field was made
constant.

Also the default copy constructor outside the class definition, which is
considered a user-provided copy constructor, was replaced with an in
class defaulted default copy constructor. This makes it easier to
understand that the copy constructor does default copying of the member
fields when only looking at the class definition, takes fewer lines of
code, and may enable some optimizations.

Bug: b/191417833
Change-Id: Ied4ba3c7957b36efc06c19ce49f4e26309fb0c66
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/55029
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Reactor/Reactor.hpp b/src/Reactor/Reactor.hpp
index 6af270c..aa115c5 100644
--- a/src/Reactor/Reactor.hpp
+++ b/src/Reactor/Reactor.hpp
@@ -213,7 +213,7 @@
 	using reference_underlying_type = T;
 
 	explicit Reference(Value *pointer, int alignment = 1);
-	Reference(const Reference<T> &ref);
+	Reference(const Reference<T> &ref) = default;
 
 	RValue<T> operator=(RValue<T> rhs) const;
 	RValue<T> operator=(const Reference<T> &ref) const;
@@ -227,7 +227,7 @@
 	int getAlignment() const;
 
 private:
-	Value *address;
+	Value *const address;
 
 	const int alignment;
 };
@@ -2697,15 +2697,12 @@
 
 template<class T>
 Reference<T>::Reference(Value *pointer, int alignment)
-    : alignment(alignment)
+    : address(pointer)
+    , alignment(alignment)
 {
-	address = pointer;
 }
 
 template<class T>
-Reference<T>::Reference(const Reference<T> &ref) = default;
-
-template<class T>
 RValue<T> Reference<T>::operator=(RValue<T> rhs) const
 {
 	Nucleus::createStore(rhs.value(), address, T::type(), false, alignment);