+2008-12-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/38380
+ * decl.c (grokdeclarator): Only set DECL_NONCONVERTING_P
+ on explicit constructors.
+ * pt.c (tsubst_copy_and_build) [CONSTRUCTOR]: Propagate
+ CONSTRUCTOR_IS_DIRECT_INIT.
+
2008-12-02 Jason Merrill <jason@redhat.com>
PR c++/35782, c++/37860
is called a converting constructor. */
if (explicitp == 2)
DECL_NONCONVERTING_P (decl) = 1;
- else if (DECL_CONSTRUCTOR_P (decl))
- {
- /* A constructor with no parms is not a conversion.
- Ignore any compiler-added parms. */
- tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (decl);
-
- if (arg_types == void_list_node)
- DECL_NONCONVERTING_P (decl) = 1;
- }
}
else if (TREE_CODE (type) == METHOD_TYPE)
{
}
r = build_constructor (init_list_type_node, n);
+ CONSTRUCTOR_IS_DIRECT_INIT (r) = CONSTRUCTOR_IS_DIRECT_INIT (t);
if (TREE_HAS_CONSTRUCTOR (t))
return finish_compound_literal (type, r);
+2008-12-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/38380
+ * g++.dg/cpp0x/initlist10.C: New test.
+ * g++.old-deja/g++.eh/ctor1.C: Default ctor is a candidate too.
+ * g++.dg/tc1/dr152.C: Likewise.
+
2008-12-03 Jakub Jelinek <jakub@redhat.com>
PR middle-end/38360
--- /dev/null
+// PR c++/38380
+// { dg-options "-std=gnu++0x" }
+
+namespace std
+{
+ struct atomic_bool
+ {
+ bool _M_i;
+
+ atomic_bool() = default;
+ ~atomic_bool() = default;
+ atomic_bool(const atomic_bool&) = delete;
+ atomic_bool& operator=(const atomic_bool&) = delete;
+
+ explicit atomic_bool(bool __i) { _M_i = __i; }
+
+ operator bool() const volatile
+ { return true; }
+ };
+}
+
+namespace __gnu_test
+{
+ struct direct_list_initializable
+ {
+ template<typename _Ttype, typename _Tvalue>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ _Ttype __v1 = { }; // default ctor
+ _Ttype __v2 { __a }; // single-argument ctor
+ }
+
+ _Tvalue __a;
+ };
+
+ void (_Concept::*__x)() __attribute__((unused))
+ = &_Concept::__constraint;
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::direct_list_initializable test;
+
+ test.operator()<std::atomic_bool, bool>();
+ return 0;
+}
namespace N1 {
struct X {
- X();
+ X(); // { dg-message "candidate" }
explicit X(const X&);
};
void f(X);
namespace N2 {
template <class T>
struct X {
- X();
+ X(); // { dg-message "candidate" }
explicit X(const X&);
};
// { dg-do assemble }
struct A
{
- A();
+ A(); // { dg-message "" } candidate
A(A&); // { dg-message "candidates" } referenced below
};