diff --git a/pocketfft_hdronly.h b/pocketfft_hdronly.h
index c623a90efc778e4a7dd22f9456f28310fcfc74e1..95e34a906f5ae49f93d5b429819fe3b2a132a8c8 100644
--- a/pocketfft_hdronly.h
+++ b/pocketfft_hdronly.h
@@ -353,6 +353,7 @@ template <typename T> T sinpi(T a)
     case 3: case -1:
       return T(-1.) - cosm1pi0(t);
     }
+  throw runtime_error("cannot happen");
   }
 
 template <typename T> T cospi(T a)
@@ -373,6 +374,7 @@ template <typename T> T cospi(T a)
     case 3: case -1:
       return sinpi0(t);
     }
+  throw runtime_error("cannot happen");
   }
 
 inline long double cospi(long double a)