[LLVMbugs] [Bug 22972] New: Clang misidentifies the parameter to blame in out-of-line definition mismatch

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 21 05:20:39 PDT 2015


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

            Bug ID: 22972
           Summary: Clang misidentifies the parameter to blame in
                    out-of-line definition mismatch
           Product: clang
           Version: 3.6
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arto at bendiken.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14081
  --> https://llvm.org/bugs/attachment.cgi?id=14081&action=edit
A minimal program to reproduce the bug.

Overview:
---------

When an out-of-line definition of a method doesn't match the original
declaration with regards to parameter const qualifiers, Clang's explanation of
the situation incorrectly identifies which parameter is to blame, picking the
leftmost parameter that has (legal) extra const qualifiers, instead of picking
the actual parameter at fault.

Steps to Reproduce:
-------------------

Compile the attached file using: clang++ -std=c++11 -Wall main.cc

Actual Results:
---------------

    main.cc:7:9: error: out-of-line definition of 'hash' does not match any
declaration in 'hasher'
    ...
    main.cc:3:19: note: type of 1st parameter of member declaration does not
match definition ('const char *' vs 'const char *const')

Expected Results:
-----------------

    main.cc:7:9: error: out-of-line definition of 'hash' does not match any
declaration in 'hasher'
    ...
    main.cc:3:32: note: type of 2nd parameter of member declaration does not
match definition ('long &' vs 'const long &')

Build Date & Platform:
----------------------

Clang 3.6.0 (tags/RELEASE_360/final) on Ubuntu 14.04.2. (Also reproduced with
Clang 3.5.0 and earlier versions.)

-- 
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/20150321/1caaa86a/attachment.html>


More information about the llvm-bugs mailing list