[Bug c++/90236] bogus error with auto non-type template argument

2019-04-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90236

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #4 from Marek Polacek  ---
Concluded we'll leave 8 as-is.  This is not a regression.

[Bug c++/90236] bogus error with auto non-type template argument

2019-04-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90236

--- Comment #3 from Marek Polacek  ---
Author: mpolacek
Date: Wed Apr 24 21:28:04 2019
New Revision: 270557

URL: https://gcc.gnu.org/viewcvs?rev=270557&root=gcc&view=rev
Log:
PR c++/90236
* g++.dg/cpp1z/nontype-auto16.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp1z/nontype-auto16.C
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug c++/90236] bogus error with auto non-type template argument

2019-04-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90236

--- Comment #2 from Marek Polacek  ---
Clearly it's this hunk:

@@ -6985,27 +7071,10 @@ convert_nontype_argument (tree type, tree expr,
tsubst_flags_t complain)
   itself value-dependent, since what we want here is its address.  */;
   else
{
- if (!DECL_P (expr))
-   {
- if (complain & tf_error)
-   error ("%qE is not a valid template argument for type %qT "
-  "because it is not an object with linkage",
-  expr, type);
- return NULL_TREE;
-   }
-
- /* DR 1155 allows internal linkage in C++11 and up.  */
- linkage_kind linkage = decl_linkage (expr);
- if (linkage < (cxx_dialect >= cxx11 ? lk_internal : lk_external))
-   {
- if (complain & tf_error)
-   error ("%qE is not a valid template argument for type %qT "
-  "because object %qD does not have linkage",
-  expr, type, expr);
- return NULL_TREE;
-   }
-
  expr = build_address (expr);
+
+ if (invalid_tparm_referent_p (type, expr, complain))
+   return NULL_TREE;
}

   if (!same_type_p (type, TREE_TYPE (expr)))

[Bug c++/90236] bogus error with auto non-type template argument

2019-04-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90236

Marek Polacek  changed:

   What|Removed |Added

   Keywords||rejects-valid
   Target Milestone|--- |7.5

--- Comment #1 from Marek Polacek  ---
g++7 also fails the same.

(Thanks Hana for providing the testcase!)