Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/7581 )
Change subject: base: Get bitunions to compile on clang 3.8.
......................................................................
base: Get bitunions to compile on clang 3.8.
clang was getting very upset and interpretting a member function
pointer as a call to the actual underlying function, and then
complaining that it was a non-static function call without an instance.
It seems what it was really upset about was that the class who's scope
the member function pointer belonged to (the current class) wasn't done
being defined. This *should* be ok as far as I can tell, but clang was
having none of it.
This change reworks how the type of the setter function arguments are
determined to work around that limitation. The bitunion test was run
with clang++ and g++ and both pass, and I've built gem5.opt for ARM
successfully.
Change-Id: Ib9351784a897af4867fe08045577e0247334ea11
Reviewed-on: https://gem5-review.googlesource.com/7581
Reviewed-by: Jason Lowe-Power <ja...@lowepower.com>
Maintainer: Gabe Black <gabebl...@google.com>
---
M src/base/bitunion.hh
1 file changed, 20 insertions(+), 15 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved
Gabe Black: Looks good to me, approved
diff --git a/src/base/bitunion.hh b/src/base/bitunion.hh
index 6e7d223..38d10da 100644
--- a/src/base/bitunion.hh
+++ b/src/base/bitunion.hh
@@ -55,26 +55,31 @@
"Bitfield base class must be empty.");
private:
- using Base::setter;
- template<typename T>
- struct TypeDeducer;
-
- template<typename T>
- friend class TypeDeducer;
-
- template<typename Type1, typename Type2>
- struct TypeDeducer<void (Base::*)(Type1 &, Type2)>
+ struct TypeDeducer
{
- typedef Type1 Storage;
- typedef Type2 Type;
+ template<typename>
+ struct T;
+
+ template<typename C, typename Type1, typename Type2>
+ struct T<void (C::*)(Type1 &, Type2)>
+ {
+ typedef Type1 Storage;
+ typedef Type2 Type;
+ };
+
+ struct Wrapper : public Base
+ {
+ using Base::setter;
+ };
+
+ typedef typename T<decltype(&Wrapper::setter)>::Storage Storage;
+ typedef typename T<decltype(&Wrapper::setter)>::Type Type;
};
protected:
- typedef typename TypeDeducer<
- decltype(&BitfieldTypeImpl<Base>::setter)>::Storage Storage;
- typedef typename TypeDeducer<
- decltype(&BitfieldTypeImpl<Base>::setter)>::Type Type;
+ typedef typename TypeDeducer::Storage Storage;
+ typedef typename TypeDeducer::Type Type;
Type getter(const Storage &storage) const = delete;
void setter(Storage &storage, Type val) = delete;
--
To view, visit https://gem5-review.googlesource.com/7581
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib9351784a897af4867fe08045577e0247334ea11
Gerrit-Change-Number: 7581
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Brandon Potter <brandon.pot...@amd.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev