[LLVMbugs] [Bug 11358] New: fails to suggest missing "typename" before type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 10 13:31:58 PST 2011


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

             Bug #: 11358
           Summary: fails to suggest missing "typename" before type
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This is not clearly a dupe for bug 8446 even though that bug is also about poor
recovery on a missing "typename" keyword. Here's the testcase:

template<typename T>
struct container {
  class iterator {};
  iterator begin() { return iterator(); }
};

template<typename T>
struct Test {
  typedef container<T> Container;
  void test() {
    Container::iterator i = c.begin();
  }
  Container c;
};

Because typedef "Container" is templated, we need a typename in order to write
"Container::iterator". Instead, clang says this:

nlewycky at ducttape:~$ llvm/Debug+Asserts/bin/clang b5411298.cc
b5411298.cc:11:24: error: expected ';' after expression
    Container::iterator i = c.begin();
                       ^
                       ;
b5411298.cc:11:25: error: use of undeclared identifier 'i'
    Container::iterator i = c.begin();
                        ^
2 errors 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