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

            Bug ID: 16353
           Summary: Missing warning (error in C++11) for passing
                    nontrivial object to varargs function via function
                    pointer
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

$ cat test.cc
struct Foo {
  Foo() {}
  Foo(const Foo&) {}
};

void f(...);

void g() {
  Foo foo;
  f(foo);
  void (*fp)(...) = f;
  fp(foo);
}
$ clang -fsyntax-only -Wall test.cc
test.cc:10:5: error: cannot pass object of non-POD type 'Foo' through variadic
function; call will abort at runtime [-Wnon-pod-varargs]
  f(foo);
    ^
1 error generated
$ clang  -fsyntax-only -Wall -std=c++11 test.cc
test.cc:10:5: error: cannot pass object of non-trivial type 'Foo' through
variadic function; call will abort at runtime [-Wnon-pod-varargs]
  f(foo);
    ^
1 error generated
$ g++ -c -o /dev/null -Wall test.cc
test.cc: In function 'void g()':
test.cc:10:8: error: cannot pass objects of non-trivially-copyable type 'struct
Foo' through '...'
test.cc:12:9: error: cannot pass objects of non-trivially-copyable type 'struct
Foo' through '...'

-- 
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