Skip to content

-std=c99 still defines 'index()' legacy posix function #16513

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 16138
Resolution FIXED
Resolved on May 31, 2013 11:58
Version unspecified
OS Linux
Reporter LLVM Bugzilla Contributor
CC @d0k

Extended Description

When I use clang to compile this file:

#include <stdio.h>

int index; // this is the line causing problem.
int main(int argc, char **argv)
{
    puts("hello");
    return 0;
}

I got the error: redefinition of 'index' as different kind of symbol.

It turns out that index is one deprecated one function in posix.

Using gcc -std=c99 fixes the problem, but clang -std=c99 doesn't do the trick.

Is this because index() is still defined in c99?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclangClang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions