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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs