diff --git a/src/OpenFOAM/db/error/StaticAssert.H b/src/OpenFOAM/db/error/StaticAssert.H
index c6cf1e7b231ff40f813ab6a5042cdf69a3285236..58fa86c170d0e34a5c677db17dc315089ac7fd97 100644
--- a/src/OpenFOAM/db/error/StaticAssert.H
+++ b/src/OpenFOAM/db/error/StaticAssert.H
@@ -67,12 +67,18 @@ class StaticAssertionTest {};
 #define StaticAssertMacro1(X,Y) StaticAssertMacro2(X,Y)
 #define StaticAssertMacro2(X,Y) X##Y
 
+#ifdef __GNUC__
+    #define StaticAssertUnusedTypedef __attribute__((unused))
+#else
+    #define StaticAssertUnusedTypedef
+#endif
+
 //- Assert that some test is true at compile-time
 #define StaticAssert(Test)                                                     \
     typedef ::Foam::StaticAssertionTest                                        \
     <                                                                          \
         sizeof( ::Foam::StaticAssertionFailed<((Test) ? true : false)>)        \
-    > StaticAssertMacro(StaticAssertionTest, __LINE__)
+    > StaticAssertMacro(StaticAssertionTest, __LINE__) StaticAssertUnusedTypedef
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //