[LLVMbugs] [Bug 6709] New: Clang instantiates unused function argument

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 25 17:56:35 PDT 2010


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

           Summary: Clang instantiates unused function argument
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: b.jacques at planet.nl
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


At least, that is the best explanation I can give. The following program:

#include <boost/scoped_ptr.hpp>

class Forward;

class MyClass {
    void foo (boost::scoped_ptr<Forward> ptr) {}
};

int main() { }

Fails to compile with:

In file included from scoped.cpp:1:
In file included from /usr/include/boost/scoped_ptr.hpp:14:
In file included from /usr/include/boost/smart_ptr/scoped_ptr.hpp:15:
/usr/include/boost/checked_delete.hpp:32:41: error: invalid application of
'sizeof' to an incomplete type 'Forward'
    typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
                                        ^~~~~~~~~
In file included from scoped.cpp:1:
In file included from /usr/include/boost/scoped_ptr.hpp:14:
/usr/include/boost/smart_ptr/scoped_ptr.hpp:80:9: note: in instantiation of
function template specialization
      'boost::checked_delete<Forward>' requested here
        boost::checked_delete( px );
        ^
scoped.cpp:6:42: note: in instantiation of member function
'boost::scoped_ptr<Forward>::~scoped_ptr' requested here
    void foo (boost::scoped_ptr<Forward> ptr) {}
                                         ^
scoped.cpp:3:7: note: forward declaration of 'Forward'
class Forward;
      ^
4 diagnostics generated.


GCC accepts the program.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list