This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Tighten length error check in string::replace



> +void
> +test05()
> +{

bool test = true;

> +  std::string str01 = "beyond skin";
> +  std::string str02 = "glam";
> +
> +  try {
> +    str01.replace(8, 7, str02.c_str(), str02.max_size() - 4);
> +  }
> +  catch(std::length_error& fail) {
> +    VERIFY( std::string(fail.what()) == "basic_string::replace" );
> +  }
> +  catch(...) {
> +    VERIFY( false );
> +  }
> +}

Is this really correct behavior, to throw length_error here? I'm
uncertain.

-benjamin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]