Note that the derivative uses the C ++ 11 syntax to invoke the base class constructor.
class base { protected: base() {} }; class derived : public base { public: derived() : base{}
g ++ 4.6 compiles this, however g ++ 4.7 does not:
$ g++-4.7 -std=c++11 -Wall -Wextra -pedantic curly.cpp -o curly curly.cpp: In constructor 'derived::derived()': curly.cpp:4:13: error: 'base::base()' is protected curly.cpp:19:24: error: within this context
What's happening?
Update 1: it also compiles without warning using clang ++ - 3.1
Update 2: Looks like a compiler error. This seems to be fixed in GCC 4.7.3.
c ++ gcc c ++ 11 g ++ uniform-initialization
xx Sep 07 '12 at 7:01 2012-09-07 07:01
source share