[LLVMbugs] [Bug 13661] New: unhelpful error message on missing parentheses on main

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 22 04:45:06 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13661

             Bug #: 13661
           Summary: unhelpful error message on missing parentheses on main
           Product: clang
           Version: 3.1
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: vanboxem.ruben at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Given this code:

    #include <iostream>

    template<typename T>
    class Val {
            T Value;
    public:
            T const& Get() const { return Value; }
            Val(T value) : Value(value) { }
    };

    using A = Val<int>;
    using B = Val<char>;

    int operator+ (A const& a, B const& b)
    {
            return a.Get() + b.Get();
    }

    template <class T, class U>
    auto add(T t, U u) -> decltype(t+u)
    {
            return t+u;
    }

    int main
    {
            A a(5);
            B b(3);
            auto Result = add(a,b);
    }

Clang complains:
test.cpp:27:13: error: unexpected type name 'A': expected expression
            A a(5);
            ^
test.cpp:30:1: error: expected ';' after top level declarator
^
;

Which is totally messed up.
The problem here is missing parentheses after the token "main".

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list