* C++ PATCH for c++/50361 (ICE with initializer_list and nullptr)
@ 2011-09-15 18:05 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2011-09-15 18:05 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 149 bytes --]
Since NULLPTR_TYPE can be a member (though I don't see the point), we
need to know how to count it.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 50361.patch --]
[-- Type: text/x-patch, Size: 1057 bytes --]
commit 435875780fc2c4d6b3bc70ca6fb2d2ff8608dfe0
Author: Jason Merrill <jason@redhat.com>
Date: Tue Sep 13 06:15:16 2011 -0400
PR c++/50361
* expr.c (count_type_elements): Handle NULLPTR_TYPE.
diff --git a/gcc/expr.c b/gcc/expr.c
index e4bb633..29bf68b 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5296,6 +5296,7 @@ count_type_elements (const_tree type, bool for_ctor_p)
case POINTER_TYPE:
case OFFSET_TYPE:
case REFERENCE_TYPE:
+ case NULLPTR_TYPE:
return 1;
case ERROR_MARK:
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr23.C b/gcc/testsuite/g++.dg/cpp0x/nullptr23.C
new file mode 100644
index 0000000..a078269
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr23.C
@@ -0,0 +1,24 @@
+// PR c++/50361
+// { dg-options -std=c++0x }
+
+#include <initializer_list>
+
+struct Foo
+{
+ Foo(std::initializer_list<Foo>) { };
+
+ template<class T> Foo(T t) { T u(t); };
+
+private:
+ union Data
+ {
+ Data() : null(nullptr) {}
+
+ std::nullptr_t null;
+ } u_;
+};
+
+int main()
+{
+ Foo f = { {} };
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-15 14:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-15 18:05 C++ PATCH for c++/50361 (ICE with initializer_list and nullptr) 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).