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

            Bug ID: 52014
           Summary: Bogus "conversion would be valid if it was derived
                    from" note with const mismatch
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: har...@gigawatt.nl
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

The invalid code

  typedef struct S s;
  const s *f();
  s *g() { return f(); }

results in

  test.cc:3:17: error: cannot initialize return object of type 's *' (aka 'S
*') with an rvalue of type 'const s *' (aka 'const S *')
  s *g() { return f(); }
                  ^~~
  test.cc:1:16: note: 'S' is not defined, but forward declared here; conversion
would be valid if it was derived from 'S'
  typedef struct S s;
                 ^
  1 error generated.

The error message is correct, but the note is not. The problem here is not
whether S is derived from itself, the problem is just the const mismatch.

-- 
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