@@ -3125,6 +3125,44 @@ static void preprocess_files()
31253125    }
31263126}
31273127
3128+ static  void  safe_api ()
3129+ {
3130+     //  this test is to make sure the safe APIs are compiling
3131+ #if  defined(__cpp_lib_string_view) || defined(__cpp_lib_span)
3132+     std::vector<std::string> filenames;
3133+ #  if  defined(__cpp_lib_string_view)
3134+     {
3135+         const  char  input[] = " code"  ;
3136+         const  std::string_view sv = input;
3137+         //  std::string_view can be implicitly converted into a std::span
3138+         simplecpp::TokenList (sv,filenames," "  );
3139+     }
3140+ #  endif 
3141+ #  ifdef  __cpp_lib_span
3142+     {
3143+         char  input[] = " code"  ;
3144+         const  std::span<char , 5 > sp = input;
3145+         simplecpp::TokenList (sp,filenames," "  );
3146+     }
3147+     {
3148+         const  char  input[] = " code"  ;
3149+         const  std::span<const  char , 5 > sp = input;
3150+         simplecpp::TokenList (sp,filenames," "  );
3151+     }
3152+     {
3153+         unsigned  char  input[] = " code"  ;
3154+         const  std::span<unsigned  char , 5 > sp = input;
3155+         simplecpp::TokenList (sp,filenames," "  );
3156+     }
3157+     {
3158+         const  unsigned  char  input[] = " code"  ;
3159+         const  std::span<const  unsigned  char , 5 > sp = input;
3160+         simplecpp::TokenList (sp,filenames," "  );
3161+     }
3162+ #  endif 
3163+ #endif 
3164+ }
3165+ 
31283166static  void  fuzz_crash ()
31293167{
31303168    {
@@ -3390,6 +3428,8 @@ int main(int argc, char **argv)
33903428
33913429    TEST_CASE (preprocess_files);
33923430
3431+     TEST_CASE (safe_api);
3432+ 
33933433    TEST_CASE (fuzz_crash);
33943434
33953435    return  numberOfFailedAssertions > 0  ? EXIT_FAILURE : EXIT_SUCCESS;
0 commit comments