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

Reply via email to