if (!baselink)
{
- if ((complain & tf_error)
- && constructor_name_p (name, qualifying_scope))
- error ("cannot call constructor %<%T::%D%> directly",
- qualifying_scope, name);
+ if (complain & tf_error)
+ {
+ if (constructor_name_p (name, qualifying_scope))
+ error ("cannot call constructor %<%T::%D%> directly",
+ qualifying_scope, name);
+ else
+ /* Lookup succeeded at parse time, but failed during
+ instantiation; must be because we're trying to refer to it
+ while forming its declaration (c++/120204). */
+ error ("declaration of %<%T::%D%> depends on itself",
+ qualifying_scope, name);
+ }
return error_mark_node;
}
--- /dev/null
+// PR c++/120204
+// { dg-do compile { target c++14 } }
+
+template<class T, int t>
+struct array{};
+
+template <typename... TArgs> struct ILEArglist {
+ using Sizes = array<int, sizeof...(TArgs)>;
+ static constexpr int size() { // { dg-bogus "not usable" }
+ Sizes &offsets_c = offsets; // { dg-error "depends on itself" }
+ return 0;
+ }
+ array<char, size()> offsets(); // { dg-error "constant expression" }
+};
+auto arglist = ILEArglist<>();