[LLVMbugs] [Bug 24330] New: clang could emit a different diagnosti when main() uses type deduction + fixIt

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 31 23:00:58 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24330

            Bug ID: 24330
           Summary: clang could emit a different diagnosti when main()
                    uses type deduction + fixIt
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This is mainly my personal taste, but I think clang could emit a different
diagnostic when 'auto' is used as return type, e.g. "
type-deduction is not allowed for main".

main.cpp:1:1: error: 'main' must return 'int'
auto main()
^~~~
int
1 error generated.


Also, it seems we emit a note in C but we don't in C++. Maybe a FixIt could be
used? i.e. "maybe you int main(void)"

./clang main.c
main.c:1:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
float main()
^
main.c:1:1: note: change return type to 'int'
float main()
^~~~~
int

-- 
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/20150801/4ac57d80/attachment.html>


More information about the llvm-bugs mailing list