References to memory mapped registers
Hello, I just tried to uprade to 4.9 and ran into a problem because it enforces the standard more strictly. With 4.8 following construct compiled nicely and did what I intended it to:
[code]
template< typename T, unsigned intaddress >
struct reference
{
static constexpr T& value = *reinterpret_
};
[/code]
With 4.9 this does not compile, since reinterpret_cast is not a const expression according to standard. So all I can do is use a static const member with out-of-class initialization (ie. runtime initialization etc.). Is there any extension in place in this compiler port that could make the old code work again? I basically only want to map registers to references in a C++-way. I am totally aware that this is platform dependent, but the addresses are anyways so I don't see why one shouldn't be able to do this.
Best regards
Question information
- Language:
- English Edit question
- Status:
- Expired
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: