http://llvm.org/bugs/show_bug.cgi?id=8640

           Summary: template diagnostic does not show point of error
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


Clang should go to the root of template instantiations when virtual functions
are instantiated on 'new'. Here's the testcase:

  template<class T1> struct C1 {
    virtual void c1() {
      T1 t1 = 3;
    }
  };

  template<class T2> struct C2 {
    void c2() {
      new C1<T2>();
    }
  };

  void f() {
    C2<int*> c2;
    c2.c2();      // error here
  }

which produces the following errors:

$ clang++ -fsyntax-only b3205969.cc 
b3205969.cc:3:7: error: cannot initialize a variable of type 'int *' with an
      rvalue of type 'int'
   T1 t1 = 3;
      ^    ~
b3205969.cc:9:8: note: in instantiation of member function 'C1<int *>::c1'
      requested here
   new C1<T2>();
       ^
1 error generated.

Note how we don't actually trace all the way through to the site of the problem
in f(). If you instead changed c1() to be non-virtual then add a call to c1 in
c2() then you would get a note on the line marked "error here" as we expect.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to