<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Default int type displayed in diagnostics."
   href="http://llvm.org/bugs/show_bug.cgi?id=15306">15306</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Default int type displayed in diagnostics.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bigcheesegs@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When clang detects an error declaring a type and cannot recover, it sets the
type to int and continues. In this case this is causing bad diagnostics which
print out int.

Reproduce:
clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free
-disable-llvm-verifier -main-file-name ELF.cpp -mrelocation-model pic
-pic-level 2 -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer -v -g -D
_GNU_SOURCE -D _DEBUG -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D
__STDC_LIMIT_MACROS -O2 -Wcovered-switch-default -Wall -W -Wno-unused-parameter
-Wwrite-strings -Wmissing-field-initializers -Wno-long-long -pedantic
-std=c++11 -fconst-strings -fdeprecated-macro -fdebug-compilation-dir
/home/mspencer/llvm-project/build/all/aubsan -ferror-limit 19 -fmessage-length
186 -fvisibility-inlines-hidden
-fsanitize=address,alignment,bool,bounds,enum,float-cast-overflow,float-divide-by-zero,integer-divide-by-zero,null,object-size,return,shift,signed-integer-overflow,unreachable,vla-bound
-mstackrealign -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -backend-option -vectorize-loops -fsyntax-only -x c++
intescape.ii

Output:
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:128:26: error: no type
named 'Elf_Dyn_Iterator' in
'llvm::object::ELFObjectFile<llvm::object::ELFType<1, 4, false> >'
  typedef typename ELFO::Elf_Dyn_Iterator EDI;
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:155:12: note: in
instantiation of function template specialization
'llvm::dumpDynamicTable<llvm::object::ELFType<1, 4, false> >'
      requested here
    return dumpDynamicTable(ELFObj, OS);
           ^
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:129:7: error: no viable
conversion from 'Elf_Dyn_iterator' (aka 'ELFEntityIterator<const Elf_Dyn>') to
'EDI' (aka 'int')
  EDI Start = O->begin_dynamic_table(),
      ^       ~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:130:7: error: no viable
conversion from 'Elf_Dyn_iterator' (aka 'ELFEntityIterator<const Elf_Dyn>') to
'EDI' (aka 'int')
      End = O->end_dynamic_table();
      ^     ~~~~~~~~~~~~~~~~~~~~~~
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:128:26: error: no type
named 'Elf_Dyn_Iterator' in
'llvm::object::ELFObjectFile<llvm::object::ELFType<0, 4, false> >'
  typedef typename ELFO::Elf_Dyn_Iterator EDI;
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:160:12: note: in
instantiation of function template specialization
'llvm::dumpDynamicTable<llvm::object::ELFType<0, 4, false> >'
      requested here
    return dumpDynamicTable(ELFObj, OS);

Expected:
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:128:26: error: no type
named 'Elf_Dyn_Iterator' in
'llvm::object::ELFObjectFile<llvm::object::ELFType<1, 4, false> >'
  typedef typename ELFO::Elf_Dyn_Iterator EDI;
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:155:12: note: in
instantiation of function template specialization
'llvm::dumpDynamicTable<llvm::object::ELFType<1, 4, false> >'
      requested here
    return dumpDynamicTable(ELFObj, OS);
           ^



Also, clang should have been able to recover in this case. The problem was a
typo in:

typedef typename ELFO::Elf_Dyn_Iterator EDI;

It should have been:

typedef typename ELFO::Elf_Dyn_iterator EDI;</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>