[LLVMbugs] [Bug 16353] New: Missing warning (error in C++11) for passing nontrivial object to varargs function via function pointer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 17 16:07:28 PDT 2013


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: unassignedclangbugs at nondot.org
          Reporter: matthewbg at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130617/39fcef2d/attachment.html>


More information about the llvm-bugs mailing list