[LLVMbugs] [Bug 17567] New: Poor diagnostic for misspelled constructor name
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Oct 13 20:48:39 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=17567
Bug ID: 17567
Summary: Poor diagnostic for misspelled constructor name
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: silvas at purdue.edu
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131014/837fb6cb/attachment.html>
More information about the llvm-bugs
mailing list