-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++11clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
| Bugzilla Link | 19218 |
| Version | 3.4 |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor |
Extended Description
template <class Derived>
class base
{
Derived* _ptr{static_cast<Derived*>(this)};
};
class test
: public base<test>
{
};The above code doesn't compile.
However if one is to write a custom constructor as follow it would work:
template <class Derived>
class base
{
public:
base() : _ptr{static_cast<Derived>(this)} {}
private:
Derived* _ptr{};
};Not sure if true, but I vaguely remember that in-class initialization should have the same side-effect as constructor initialization lists.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++11clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"