[LLVMbugs] [Bug 7737] New: [c++] clang++ throws compile error on never used template function that calls a protected function
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jul 28 08:54:59 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7737
Summary: [c++] clang++ throws compile error on never used
template function that calls a protected function
Product: clang
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: release blocker
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: mike.jackson at bluequartz.net
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
// BEGIN CODE
class Foo
{
public:
int pub_function() {return 1;}
Foo() {}
virtual ~Foo() {};
protected:
int protected_function() { return 2;}
};
template<typename T>
void outside_function(Foo* self)
{
self->protected_function();
}
int main (int argc, char const *argv[])
{
Foo* f = new Foo;
delete f;
return 0;
}
// END CODE
GCC compiles this code just fine where as clang throws a compile error. Note
that the function "outside_function" is never actually used. This type of code
is currently present in the vtkTIFFReader.cxx of the VTK.org code base.
The clang compile error is:
528:[mjackson at ferb:Build]$ clang++ ~/Desktop/VTKBug.cpp -o
~/Desktop/VTKBug-clang
/Users/mjackson/Desktop/VTKBug.cpp:14:9: error: 'protected_function' is a
protected member of 'Foo'
self->protected_function();
^
/Users/mjackson/Desktop/VTKBug.cpp:8:7: note: declared protected here
int protected_function() { return 2;}
^
1 error generated.
530:[mjackson at ferb:Build]$ clang --version
clang version 2.8 (trunk 109582)
Target: x86_64-apple-darwin9
Thread model: posix
Not really sure if this is a clang bug or really a bug in the vtkTIFFReader
code. I am unfamiliar with the spec on this.
Thanks
Mike Jackson
Principal Software Engineer
BlueQuartz Software
www.bluequartz.net
--
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