[llvm-bugs] [Bug 46417] New: False line number in a function definition with "void" parameter

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 22 01:55:19 PDT 2020


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

            Bug ID: 46417
           Summary: False line number in a function definition with "void"
                    parameter
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: haoxintu at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

This code, bug.cc, clang might give the wrong line number in error messages.

$cat bug.cc
void foo ( 
void a,
double b,
int c,
void  d,
int e,
void f) 
{} 


$clang++ -c bug.cc
bug.cc:1:10: error: 'void' must be the first and only parameter if specified
void foo ( 
         ^
bug.cc:1:10: error: 'void' must be the first and only parameter if specified
bug.cc:1:10: error: 'void' must be the first and only parameter if specified
3 errors generated.

While in GCC
$g++ -c bug.cc
bug.cc:2:6: error: invalid use of type ‘void’ in parameter declaration
    2 | void a,
      | ~~~~~^
bug.cc:5:7: error: invalid use of type ‘void’ in parameter declaration
    5 | void  d,
      | ~~~~~~^
bug.cc:7:6: error: invalid use of type ‘void’ in parameter declaration
    7 | void f)
      | ~~~~~^

$clang++ --version
clang version 11.0.0 (https://github.com/llvm/llvm-project
e6aba43cda848f4a8cfa5ce9f174b77def10e9df)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/compilers/llvm-clang/llvm-project/build/bin

I guess Clang just gives the wrong line number in this case. If Clang just
emits the first error and then stops to parse the code intentionally, Clang
might have some duplicated error messages.

Any way, I think Clang has some diagnostic issues in this case.

-- 
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/20200622/966a6a72/attachment.html>


More information about the llvm-bugs mailing list