[LLVMbugs] [Bug 8755] New: "class X" where X names a typedef has a worse error when X is templated

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 7 18:56:37 PST 2010


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

           Summary: "class X" where X names a typedef has a worse error
                    when X is templated
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


This testcase shows a case where clang emits a worse error, just due to the
template:

  template <typename T>
  struct A {
    typedef int iterator;
  };

  template <typename T>
  void f() {
    class A <T> ::iterator foo;
  }

  void g() {
    f<int>();
  }

which generates:

  b3264413.cc:8:17: error: no class named 'iterator' in 'A<int>'
    class A <T> ::iterator foo;
                  ^
  b3264413.cc:12:3: note: in instantiation of function template specialization
        'f<int>' requested here
    f<int>();
    ^
  1 error generated.

while the untemplated example:

  struct A {
    typedef int iterator;
  };

  void f() {
    class A::iterator foo;
  }

generates the much nicer:

  class.cc:6:12: error: elaborated type refers to a typedef
    class A::iterator foo;
             ^
  class.cc:2:15: note: declared here
    typedef int iterator;
                ^
  1 error generated.

-- 
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.



More information about the llvm-bugs mailing list