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

            Bug ID: 40535
           Summary: Error message for incorrectly specified constructor
                    method is unhelpful
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: rgovos...@gmail.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

class Foo {
        Foo(int x);
    };

    Foo(int x) {
        // nothing
    }

Compiling this code gives the following error messages:

    foo.cpp:5:5: error: expected unqualified-id
    Foo(int x) {
        ^
    foo.cpp:5:5: error: expected ')'
    foo.cpp:5:4: note: to match this '('
    Foo(int x) {
       ^
    2 errors generated.

The actual problem is that I should have written:

    Foo::Foo(int x) {
        // nothing
    }

This mistake was easy because I moved the implementation of Foo::Foo from
inside the class, where it doesn't need to be qualified with the class name, to
outside the class, where it does.

clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to