Skip to content

clang redefines size_t silently but then complains #2799

@filcab

Description

@filcab
Bugzilla Link 2427
Resolution FIXED
Resolved on Nov 07, 2018 00:21
Version unspecified
OS All
CC @efriedma-quic

Extended Description

clang doesn't compile the following code, although gcc happily compiles:

#include <stddef.h>
extern void* f(void** p, size_t s);

#include <stdlib.h>

void* f(void** p, size_t s)
{
}

I think the problem is with the redefinition of size_t in stdlib.h (a system header) to something different from what is defined in stddef.h.

In Mac OS X, clang complains:
[filcab@farnsworth ~] $ clang b.c
b.c:7:7: error: conflicting types for 'f'
void* f(void** p, size_t s)
^
b.c:2:14: error: previous declaration is here
extern void* f(void** p, size_t s);
^
2 diagnostics generated.

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