public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/80384, ICE with dependent noexcept-specifier
@ 2017-06-09 20:00 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2017-06-09 20:00 UTC (permalink / raw)
  To: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

If we're going to consider the noexcept-specifier for deduction, we
also need it to make the type dependent.

Tested x86_64-pc-linux-gnu, applying to trunk and 7.

[-- Attachment #2: 80384.diff --]
[-- Type: text/plain, Size: 1431 bytes --]

commit c51759f129a602eeb835473e7c1480046757c12f
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 31 17:39:50 2017 -0400

            PR c++/80384 - ICE with dependent noexcept-specifier
    
            * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
            noexcept-specifier.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 48fa9b8..a72c314 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -23438,6 +23438,14 @@ dependent_type_p_r (tree type)
 	   arg_type = TREE_CHAIN (arg_type))
 	if (dependent_type_p (TREE_VALUE (arg_type)))
 	  return true;
+      if (cxx_dialect >= cxx1z)
+	{
+	  /* A value-dependent noexcept-specifier makes the type dependent.  */
+	  tree spec = TYPE_RAISES_EXCEPTIONS (type);
+	  if (spec && TREE_PURPOSE (spec)
+	      && value_dependent_expression_p (TREE_PURPOSE (spec)))
+	    return true;
+	}
       return false;
     }
   /* -- an array type constructed from any dependent type or whose
diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type15.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type15.C
new file mode 100644
index 0000000..cc5a3ed
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type15.C
@@ -0,0 +1,11 @@
+// PR c++/80384
+// { dg-options -std=c++17 }
+
+template<class> struct foo;
+template<bool B>
+struct foo<int() noexcept(B)> {
+    static const bool value = B; 
+};
+
+static_assert(!foo<int()>::value);
+static_assert(foo<int() noexcept>::value);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-09 20:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 20:00 C++ PATCH for c++/80384, ICE with dependent noexcept-specifier Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).