<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Attaching v3 of the patch. Added your
      case to the current test and fixed my silly non-array mistake.<br>
      -- Vassil<br>
      On 18/01/16 20:38, Richard Smith wrote:<br>
    </div>
    <blockquote
cite="mid:CAOfiQqksq=MjkHHkZzm8ZAwB8ahjd=qGR0iRWiyp4e=y-MYVtQ@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <p dir="ltr">Please also add a test case that your old patch would
        have failed on, such as:</p>
      <p dir="ltr">m1.h:<br>
        extern int a[];</p>
      <p dir="ltr">m2.h:<br>
        extern int a[5];</p>
      <p dir="ltr">x.cc:<br>
        #include "m1.h"<br>
        #include "m2.h"<br>
        int *p = a;</p>
      <div class="gmail_quote">On Jan 18, 2016 9:28 AM, "Vassil
        Vassilev" <<a moz-do-not-send="true"
          href="mailto:vvasilev@cern.ch">vvasilev@cern.ch</a>> wrote:<br
          type="attribution">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">On 17/01/16
          06:34, Douglas Gregor wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              On Jan 16, 2016, at 3:41 PM, Vassil Vassilev <<a
                moz-do-not-send="true" href="mailto:vvasilev@cern.ch"
                target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:vvasilev@cern.ch">vvasilev@cern.ch</a></a>> wrote:<br>
              <br>
              Hi,<br>
                Could somebody review the attached patch. It fixes <a
                moz-do-not-send="true"
                href="https://llvm.org/bugs/show_bug.cgi?id=26179"
                rel="noreferrer" target="_blank"><a class="moz-txt-link-freetext" href="https://llvm.org/bugs/show_bug.cgi?id=26179">https://llvm.org/bugs/show_bug.cgi?id=26179</a></a><br>
              Many thanks!<br>
              Vassil<br>
<0001-modules-Teach-clang-to-how-to-merge-variable-redecls.patch><br>
            </blockquote>
            <br>
            +      // We can get decls with different types on the
            redecl chain. Eg.<br>
            +      // template <typename T> struct S { static T
            Var[]; }; // #1<br>
            +      // template <typename T> T
            S<T>::Var[sizeof(T)]; // #2<br>
            +      // Trying to compare #1 and #2 should go through
            their canonical decls.<br>
            +      QualType VarXTy =
            VarX->getCanonicalDecl()->getType();<br>
            +      QualType VarYTy =
            VarY->getCanonicalDecl()->getType();<br>
            +      if (Context.hasSameType(VarXTy, VarYTy))<br>
            +        return true;<br>
            <br>
            Completing an incomplete array is (I think) the only case in
            which this can happen. How about checking for that case
            specifically (i.e., it’s okay to have one be an incomplete
            array and the other to be any other kind of array with the
            same element type), rather than a blanket check on the
            canonical declaration types?<br>
            <br>
                    - Doug<br>
            <br>
          </blockquote>
          Thanks for the comments. Patch v2 attached.<br>
          -- Vassil<br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>