[llvm-bugs] [Bug 35138] New: Confusing error message with missing semicolon and assert

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 30 15:05:00 PDT 2017


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

            Bug ID: 35138
           Summary: Confusing error message with missing semicolon and
                    assert
           Product: clang
           Version: trunk
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kparzysz at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

I just ran into this. This is not really a bug as much as it's an unfortunate
consequence of macro expansion. Maybe it's possible for clang to detect this as
"missing semicolon" anyway...

--- confusing.c ---
#include <assert.h>

int sammy(void);

int danny() {
  int x = sammy()
  assert(x != 0);
  return x+1;
}
-------------------

$ clang -c confusing.c
confusing.c:7:3: error: called object type 'int' is not a function or function
      pointer
  assert(x != 0);
  ^
/usr/include/assert.h:89:3: note: expanded from macro 'assert'
  ((expr)                                                               \
  ^
1 error generated.

-- 
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/20171030/43041988/attachment.html>


More information about the llvm-bugs mailing list