Here, we were wrongly thinking that (const Options&)Widget<T>::c_options is
not value-dependent because neither the type nor the (value of) c_options
are dependent, but since we're binding it to a reference we also need to
consider that it has a value-dependent address.
PR c++/103968
gcc/cp/ChangeLog:
* pt.cc (value_dependent_expression_p): Check
has_value_dependent_address for conversion to reference.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-mem1.C: New test.
if (TREE_CODE (expression) == TREE_LIST)
return any_value_dependent_elements_p (expression);
+ if (TREE_CODE (type) == REFERENCE_TYPE
+ && has_value_dependent_address (expression))
+ return true;
+
return value_dependent_expression_p (expression);
}
--- /dev/null
+// PR c++/103968
+// { dg-do compile { target c++11 } }
+
+template <typename Opt, Opt const& options>
+struct trait
+{
+ template <typename T>
+ struct NonInstantiated{};
+};
+
+struct Options {};
+
+template <typename T>
+struct Widget
+{
+ static constexpr auto c_options = Options{};
+ using Trait = trait<decltype(c_options), c_options>;
+};
+
+Widget<int>::Trait b{}; // Crashes GCC > 10.3