http://llvm.org/bugs/show_bug.cgi?id=16407

            Bug ID: 16407
           Summary: Assignment from "void *" without cast treated as error
                    within extern "C" block
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

[gibbs@aslan ~]$ cat foo.cpp

#ifdef __cplusplus
extern "C" {
#endif

struct foo {
    int a;
};

static inline void
initialize_foo(void *data)
{
    struct foo *foo = data;

    foo->a = 1;
}

#ifdef __cplusplus
}
#endif

int
main(int argc, const char *argv[])
{
    struct foo my_foo;

    initialize_foo(&my_foo);

    return (0);
}
[gibbs@aslan ~]$ clang++ -v
FreeBSD clang version 3.3 (trunk 178860) 20130405
Target: x86_64-unknown-freebsd10.0
Thread model: posix
[gibbs@aslan ~]$ clang++ foo.cpp
foo.cpp:13:14: error: cannot initialize a variable of type 'struct foo *' with
      an lvalue of type 'void *'
        struct foo *foo = data;
                    ^     ~~~~
1 error generated.

The work around for this is trivial, but in our environment would mean forking
a third party C header file.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to