In general, when we see a dependent using-declaration we don't know whether
it names a function or not, so it doesn't get an OVERLOAD unless we see
overloads of the same name in the current class. In the case of an
inherited constructor we could figure that out from the name, but it's
simpler to handle USING_DECL properly.
* cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
introduced by a using-declaration.
From-SVN: r273623
+2019-07-20 Jason Merrill <jason@redhat.com>
+
+ * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
+ introduced by a using-declaration.
+
2019-07-20 Jason Merrill <jason@redhat.com>
Reduce memory consumption for push/pop_access_scope.
/* Whether this overload was introduced by a using decl. */
bool using_p () const
{
- return TREE_CODE (ovl) == OVERLOAD && OVL_USING_P (ovl);
+ return (TREE_CODE (ovl) == USING_DECL
+ || (TREE_CODE (ovl) == OVERLOAD && OVL_USING_P (ovl)));
}
bool hidden_p () const
{
--- /dev/null
+// Deduction from inherited constructors isn't supported yet, but we shouldn't
+// crash. It may well be supported in C++23.
+
+//{ dg-do compile { target c++17 } }
+
+template <class T> struct A
+{
+ A(T);
+};
+
+template <class T> struct B: A<T>
+{
+ using A<T>::A;
+};
+
+int main()
+{
+ B b = 42; // { dg-line init }
+ // { dg-prune-output "no matching function" }
+ // { dg-error "class template argument deduction" "" { target *-*-* } init }
+}