[cfe-dev] Recent regression in static analyzer

Miklos Vajna via cfe-dev cfe-dev at lists.llvm.org
Mon Jan 9 07:47:16 PST 2017


Hi,

On Sun, Jan 8, 2017 at 12:37 AM, Miklos Vajna via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> And sorry for not making the sample more minimal, this code is
> originally part of LibreOffice's filter/source/msfilter/rtfutil.cxx,
> this is already a quite small part of the preprocessed source. :-)

Here is an (I think) minimal reproducer:

----
struct S;

template <typename T> struct C {
public:
  C(const S &left_, const T &right_) : left(left_), right(right_) {}

private:
  const S &left;
  const T &right;
};

template <typename T, int N>
inline T operator+(const T &left, const char (&right)[N]) {
  return C<const char[N]>(left, right);
}

struct S {
  template <typename T> S(T &) {}

  template <typename T> S(const C<T> &) {}
};

S f() { return S("{") + "}"; }
----

Thanks,

Miklos



More information about the cfe-dev mailing list