Skip to content

gcc compat: clang rejects pointer/int mismatch in conditional expression #3679

@llvmbot

Description

@llvmbot
Bugzilla Link 3307
Resolution FIXED
Resolved on Mar 12, 2010 00:57
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @efriedma-quic

Extended Description

clang rejects the following code which gcc accepts with a warning:-

ddunbar@lordcrumb:hard$ cat conditional-compat.c
void f0(int a0, void *a1, int a2) {
a0 ? a1 : a2;
}
ddunbar@lordcrumb:hard$ clang -fsyntax-only conditional-compat.c
conditional-compat.c:2:6: error: incompatible operand types ('void *' and 'int')
a0 ? a1 : a2;
^ ~~ ~~
1 diagnostic generated.
ddunbar@lordcrumb:hard$ gcc -fsyntax-only conditional-compat.c
conditional-compat.c: In function 'f0':
conditional-compat.c:2: warning: pointer/integer type mismatch in conditional expression

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions