[LLVMbugs] [Bug 13084] New: Clang should warn when namespace isn't closed in same header

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 11 13:17:22 PDT 2012


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

             Bug #: 13084
           Summary: Clang should warn when namespace isn't closed in same
                    header
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$ cat test.h
#include <string>

namespace foo {
std::string bar() { return "Hello World"; }

// Forgot to close namespace.
$ cat test.cc
#include "test.h"

#include <vector>

$ clang++ -c test.cc
In file included from test.cc:3:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/vector:62:
/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/bits/stl_construct.h:114:24:
error: 
      no template named 'iterator_traits'; did you mean
'::std::iterator_traits'?
      typedef typename iterator_traits<_ForwardIterator>::value_type
                       ^
/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/bits/stl_iterator_base_types.h:124:12:
note: 
      '::std::iterator_traits' declared here
    struct iterator_traits
           ^

...  // >20 errors


It's not immediately obvious that this error spew is caused by the missing '}'
in test.h, since test.h isn't mentioned in the messages.

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