diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/pt.cc | 14 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/nontype-auto20.C | 5 |
2 files changed, 11 insertions, 8 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 4a2b33e..586ad1c 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -26931,16 +26931,14 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) } return false; } - else if (TREE_CODE (type) == TYPENAME_TYPE) - return false; - else if (TREE_CODE (type) == DECLTYPE_TYPE) - return false; else if (TREE_CODE (type) == NULLPTR_TYPE) return false; - /* A bound template template parm could later be instantiated to have a valid - nontype parm type via an alias template. */ - else if (cxx_dialect >= cxx11 - && TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM) + else if (TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM + && cxx_dialect < cxx11) + /* Fall through; before C++11 alias templates, a bound ttp + always instantiates into a class type. */; + else if (WILDCARD_TYPE_P (type)) + /* Any other wildcard type not already handled above is allowed. */ return false; else if (TREE_CODE (type) == COMPLEX_TYPE) /* Fall through. */; diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto20.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto20.C new file mode 100644 index 0000000..87a2a5f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto20.C @@ -0,0 +1,5 @@ +// PR c++/104074 +// { dg-do compile { target c++17 } } + +template<auto> class gr_sp; +template<class T> using gr_rp = gr_sp<T::value + 42>; |