Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

over 5 years ago

Language

C++

Compiler

gcc HEAD 10.0.0 20190825 (experimental)

Options
Warnings
Don't Use Boost
C++11
no pedantic
Raw compiler options
bar.cpp

Author

anonymous

over 5 years ago

bar.h
bar.cpp
foo.h

$ g++ prog.cc -Wall -Wextra -std=c++11 bar.cpp
In file included from prog.cc:1:
bar.h: In instantiation of 'void custom_deleter::operator()(T*) [with T = Foo]':
/opt/wandbox/gcc-head/include/c++/10.0.0/bits/unique_ptr.h:349:17:   required from 'std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = Foo; _Dp = custom_deleter]'
bar.h:12:7:   required from here
bar.h:8:9: warning: possible problem detected in invocation of 'operator delete' [-Wdelete-incomplete]
    8 |         delete param;
      |         ^~~~~~
bar.h:7:25: warning: 'param' has incomplete type
    7 |     void operator ()(T* param) {
      |                      ~~~^~~~~
bar.h:3:8: note: forward declaration of 'struct Foo'
    3 | struct Foo;
      |        ^~~
bar.h:8:9: note: neither the destructor nor the class-specific 'operator delete' will be called, even if they are declared when the class is defined
    8 |         delete param;
      |         ^~~~~~
Allocated: 1
Allocated: 2
Deallocating: 1
Deallocating: 2
Exit Code:
0