public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4045] c++: Add testcase for DR 2604
@ 2022-11-15  7:18 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-11-15  7:18 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e0f4fcf9dfb8794a11d4ee63899b820aa9257f50

commit r13-4045-ge0f4fcf9dfb8794a11d4ee63899b820aa9257f50
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Nov 15 07:57:42 2022 +0100

    c++: Add testcase for DR 2604
    
    As the following testcase shows, I think we don't inherit template's
    attributes into specializations.
    
    2022-11-15  Jakub Jelinek  <jakub@redhat.com>
    
            * g++.dg/DRs/dr2604.C: New test.

Diff:
---
 gcc/testsuite/g++.dg/DRs/dr2604.C | 53 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gcc/testsuite/g++.dg/DRs/dr2604.C b/gcc/testsuite/g++.dg/DRs/dr2604.C
new file mode 100644
index 00000000000..64bdf5d11a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2604.C
@@ -0,0 +1,53 @@
+// DR 2604 - Attributes for an explicit specialization.
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wunused-parameter" }
+
+template<typename>
+[[noreturn]] void
+foo ([[maybe_unused]] int i)
+{
+  for (;;);
+}
+
+template<>
+void
+foo<int> (int i)	// { dg-warning "unused parameter 'i'" }
+{
+}
+
+template<typename>
+void
+bar (int i)		// { dg-warning "unused parameter 'i'" }
+{
+}
+
+template<>
+[[noreturn]] void
+bar<int> ([[maybe_unused]] int i)
+{
+  for (;;);
+}
+
+[[noreturn]] void
+baz ()
+{
+  foo<long> (0);
+}
+
+[[noreturn]] void
+qux ()
+{
+  foo<int> (0);
+}			// { dg-warning "'noreturn' function does return" }
+
+[[noreturn]] void
+garply ()
+{
+  bar<long> (0);
+}			// { dg-warning "'noreturn' function does return" }
+
+[[noreturn]] void
+corge ()
+{
+  bar<int> (0);
+}

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

only message in thread, other threads:[~2022-11-15  7:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15  7:18 [gcc r13-4045] c++: Add testcase for DR 2604 Jakub Jelinek

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).