mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:37:45 +00:00
LibIPC: Forward declare the encode() and decode() template functions
For the most part, we try to provide specializations of these functions in various headers by including "LibIPC/Forward.h" and then declaring encode() and decode() specializations. However, without any forward declaration of these types, we aren't actually specializing anything. Rather, we are just declaring overloads, which trips up the base encode and decode template definitions. The result is that LibIPC is very sensitive to include order, and the DependentFalse<> static assertion would fail if the includes weren't perfectly ordered. By properly forward declaring these templates, we can make sure the specializations receive precedence over the base templates.
This commit is contained in:
parent
421ebc2e29
commit
b1ea418d14
2 changed files with 7 additions and 1 deletions
|
@ -16,7 +16,7 @@
|
|||
namespace IPC {
|
||||
|
||||
template<typename T>
|
||||
bool encode(Encoder&, T&)
|
||||
bool encode(Encoder&, T const&)
|
||||
{
|
||||
static_assert(DependentFalse<T>, "Base IPC::encode() was instantiated");
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
@ -15,4 +15,10 @@ class Message;
|
|||
class File;
|
||||
class Stub;
|
||||
|
||||
template<typename T>
|
||||
bool encode(Encoder&, T const&);
|
||||
|
||||
template<typename T>
|
||||
ErrorOr<void> decode(Decoder&, T&);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue