diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-03-17 16:11:59 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-03-17 16:11:59 +0000 |
| commit | 9647d3ca02aa5d53a210613b19de622f604d87eb (patch) | |
| tree | 4040421bfef983c74b15484f3ebf9dfc03a67ccc /clang/test/SemaCXX/auto-subst-failure.cpp | |
| parent | 2ef0c69df1eb57b22d9555e999ab586d5944c777 (diff) | |
| download | bcm5719-llvm-9647d3ca02aa5d53a210613b19de622f604d87eb.tar.gz bcm5719-llvm-9647d3ca02aa5d53a210613b19de622f604d87eb.zip | |
Fix PR9488: 'auto' type substitution can fail (for instance, if it creates a reference-to-void type). Don't crash if it does.
Also fix an issue where type source information for the resulting type was being lost.
llvm-svn: 127811
Diffstat (limited to 'clang/test/SemaCXX/auto-subst-failure.cpp')
| -rw-r--r-- | clang/test/SemaCXX/auto-subst-failure.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/auto-subst-failure.cpp b/clang/test/SemaCXX/auto-subst-failure.cpp new file mode 100644 index 00000000000..442c7e82ccd --- /dev/null +++ b/clang/test/SemaCXX/auto-subst-failure.cpp @@ -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'}} +} |

