re PR c++/54325 (C++11 uniform initialization syntax for argument-less abstract base class constructor fails)

PR c++/54325
	* call.c (build_new_method_call_1): Don't use build_value_init for
	user-provided default constructors.

From-SVN: r194820
This commit is contained in:
Jason Merrill 2013-01-02 15:54:42 -05:00 committed by Jason Merrill
parent 3fd005a689
commit 3a322efd85
3 changed files with 30 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2013-01-02 Jason Merrill <jason@redhat.com>
PR c++/54325
* call.c (build_new_method_call_1): Don't use build_value_init for
user-provided default constructors.
* decl.c (check_default_argument): Use LOOKUP_IMPLICIT.
PR c++/55032

View File

@ -7534,6 +7534,9 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args,
build_special_member_call. */
if (CONSTRUCTOR_NELTS (init_list) == 0
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype)
/* For a user-provided default constructor, use the normal
mechanisms so that protected access works. */
&& !type_has_user_provided_default_constructor (basetype)
&& !processing_template_decl)
init = build_value_init (basetype, complain);

View File

@ -0,0 +1,23 @@
// PR c++/54325
// { dg-options -std=c++11 }
class base
{
protected:
base()
{}
};
class derived : public base
{
public:
derived()
: base{} // <-- Note the c++11 curly brace syntax
{}
};
int main()
{
derived d1;
return 0;
}