On Thu, March 17, 2011 12:06, Richard Smith wrote:
> In PR9488 I observed that clang crashes if auto type substitution fails.
> This can happen if 'auto' is deduced as 'void' in the context of an 'auto
> &' type. Testing the fix for this issue exposed another issue: the type
> source information for the substituted type was not being built.
>
> The attached patch fixes these issues. Please review!

Oops, I forgot to 'svn add' the new test before creating the patch! Test
is attached.

Thanks!
Richard
Index: test/SemaCXX/auto-subst-failure.cpp
===================================================================
--- test/SemaCXX/auto-subst-failure.cpp	(revision 0)
+++ test/SemaCXX/auto-subst-failure.cpp	(revision 0)
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+void f() {
+  auto a = f(); // expected-error {{variable has incomplete type 'void'}}
+  auto &b = f(); // expected-error {{cannot form a reference to 'void'}}
+  auto *c = f(); // expected-error {{incompatible initializer of type 'void'}}
+
+  auto d(f()); // expected-error {{variable has incomplete type 'void'}}
+  auto &&e(f()); // expected-error {{cannot form a reference to 'void'}}
+  auto *g(f()); // expected-error {{incompatible initializer of type 'void'}}
+
+  (void)new auto(f()); // expected-error {{allocation of incomplete type 'void'}}
+  (void)new auto&(f()); // expected-error {{cannot form a reference to 'void'}}
+  (void)new auto*(f()); // expected-error {{incompatible constructor argument of type 'void'}}
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to