Add [[gsl::Pointer]] attribute to class StringData

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Server Serverless 2023-04-17
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The presence of this attribute allows the compiler to catch dangling references.

      std::string_view has this annotation. we should follow suit.

      "This ensures that constructing a StringPiece (StringData in our case) from a temporary (xvalue)
      std::string will produce a compiler warning (error for us). And it
      matches the annotation libc++ does for std::string_view."

      https://bugs.chromium.org/p/chromium/issues/detail?id=1282468

      class [[gsl::Pointer]] StringData {
      ...
      };
      

      https://godbolt.org/z/Kdoec79ar

            Assignee:
            Matt Broadstone
            Reporter:
            Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: