summaryrefslogtreecommitdiffstats
path: root/clang/test/PCH/cxx-trailing-return.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-02-10 09:58:53 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-02-10 09:58:53 +0000
commit5e580292ac86462f5094df2c879c4c617e611ba7 (patch)
treeea774c402faa75daab0e34980a627fe60f0a5540 /clang/test/PCH/cxx-trailing-return.cpp
parent25a01eca11e88b1ff2a4a91a340f1ba7fef85ffa (diff)
downloadbcm5719-llvm-5e580292ac86462f5094df2c879c4c617e611ba7.tar.gz
bcm5719-llvm-5e580292ac86462f5094df2c879c4c617e611ba7.zip
Track whether a function type has a trailing return type as type sugar. Use this
to pretty-print such function types better, and to fix a case where we were not instantiating templates in lexical order. In passing, move the Variadic bit from Type's bitfields to FunctionProtoType to get the Type bitfields down to 32 bits. Also ensure that we always substitute the return type of a function when substituting explicitly-specified arguments, since that can cause us to bail out with a SFINAE error before we hit a hard error in parameter substitution. llvm-svn: 150241
Diffstat (limited to 'clang/test/PCH/cxx-trailing-return.cpp')
-rw-r--r--clang/test/PCH/cxx-trailing-return.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/PCH/cxx-trailing-return.cpp b/clang/test/PCH/cxx-trailing-return.cpp
new file mode 100644
index 00000000000..ff85f6d1c5f
--- /dev/null
+++ b/clang/test/PCH/cxx-trailing-return.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t-cxx11
+// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t-cxx11 -verify %s
+
+#ifndef HEADER_INCLUDED
+
+#define HEADER_INCLUDED
+typedef auto f() -> int; // expected-note {{here}}
+typedef int g(); // expected-note {{here}}
+
+#else
+
+typedef void f; // expected-error {{typedef redefinition with different types ('void' vs 'auto () -> int')}}
+typedef void g; // expected-error {{typedef redefinition with different types ('void' vs 'int ()')}}
+
+#endif
OpenPOWER on IntegriCloud