[llvm] r244199 - Fix Visual C++ error C2248:

Yaron Keren via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 00:59:26 PDT 2015


Author: yrnkrn
Date: Thu Aug  6 02:59:26 2015
New Revision: 244199

URL: http://llvm.org/viewvc/llvm-project?rev=244199&view=rev
Log:
Fix Visual C++ error C2248: 
'llvm::TrailingObjects<`anonymous-namespace'::Class1,short,llvm::NoTrailingTypeArg>::additionalSizeToAlloc' :
cannot access protected member declared in class
 'llvm::TrailingObjects<`anonymous-namespace'::Class1,short,llvm::NoTrailingTypeArg>'

 I'm not sure how this compiles with gcc.
 Aren't protecteded members accessible only with protected or public inheritance?
 

Modified:
    llvm/trunk/unittests/Support/TrailingObjectsTest.cpp

Modified: llvm/trunk/unittests/Support/TrailingObjectsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TrailingObjectsTest.cpp?rev=244199&r1=244198&r2=244199&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/TrailingObjectsTest.cpp (original)
+++ llvm/trunk/unittests/Support/TrailingObjectsTest.cpp Thu Aug  6 02:59:26 2015
@@ -16,7 +16,7 @@ namespace {
 // This class, beyond being used by the test case, a nice
 // demonstration of the intended usage of TrailingObjects, with a
 // single trailing array.
-class Class1 final : private TrailingObjects<Class1, short> {
+class Class1 final : protected TrailingObjects<Class1, short> {
   friend TrailingObjects;
 
   unsigned NumShorts;
@@ -47,7 +47,7 @@ public:
 
 // Here, there are two singular optional object types appended.
 // Note that it fails to compile without the alignment spec.
-class LLVM_ALIGNAS(8) Class2 final : private TrailingObjects<Class2, double, short> {
+class LLVM_ALIGNAS(8) Class2 final : protected TrailingObjects<Class2, double, short> {
   friend TrailingObjects;
 
   bool HasShort, HasDouble;




More information about the llvm-commits mailing list