<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 --- - Poor diagnostic for misspelled constructor name"
   href="http://llvm.org/bugs/show_bug.cgi?id=17567">17567</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Poor diagnostic for misspelled constructor name
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>silvas@purdue.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>sean:~/tmp % cat test_diag.cpp                                                  
class Framebuffer {
  FrameBuffer() {}
};
sean:~/tmp % g++ test_diag.cpp                                                  
test_diag.cpp:2:15: error: ISO C++ forbids declaration of ‘FrameBuffer’ with no
type [-fpermissive]
sean:~/tmp % clang++ test_diag.cpp
test_diag.cpp:2:3: error: C++ requires a type specifier for all declarations
  FrameBuffer() {}
  ^~~~~~~~~~~
1 error generated.


The GCC diagnostic for this left me scratching my head for a couple minutes
("but it's a constructor, it doesn't need a return type ... <head scratching
and confusion> ... Ohhhh, I misspelled it"). It turns out that clang's
diagnostic isn't any better and would have provoked the same confusion. It
would be *much* better if we typo-correct constructor names in this case the
same way that we do for destructors:

sean:~/tmp % cat test_diag_dtor.cpp                                             
class Framebuffer {
  ~FrameBuffer() {}
};
sean:~/tmp % g++ test_diag_dtor.cpp
test_diag.cpp:2:15: error: expected class-name before ‘(’ token
sean:~/tmp % clang++ test_diag_dtor.cpp
test_diag.cpp:2:4: error: expected the class name after '~' to name a
destructor
  ~FrameBuffer() {}
   ^~~~~~~~~~~
   Framebuffer
1 error generated.</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>