diff options
author | Zhihao Yuan <zy@miator.net> | 2018-03-24 04:32:11 +0000 |
---|---|---|
committer | Zhihao Yuan <zy@miator.net> | 2018-03-24 04:32:11 +0000 |
commit | 2c5471ddc7858c56274de830481f940de7c509e7 (patch) | |
tree | 88da40b30da996ddee69f16c2abb0ddec199ee48 /clang/test/Parser/cxx1z-class-template-argument-deduction.cpp | |
parent | 40eb34607c7f5948a62bea3fd510c749ff7f109d (diff) | |
download | bcm5719-llvm-2c5471ddc7858c56274de830481f940de7c509e7.tar.gz bcm5719-llvm-2c5471ddc7858c56274de830481f940de7c509e7.zip |
[C++17] Fix class template argument deduction for default constructors without an initializer
Summary:
As the title says, this makes following code compile:
```
template<typename> struct Foo {};
Foo() -> Foo<void>;
Foo f; // ok
```
Thanks Nicolas Lesser for coining the fix.
Reviewers: rsmith, lichray
Reviewed By: rsmith, lichray
Subscribers: lichray, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D38216
llvm-svn: 328409
Diffstat (limited to 'clang/test/Parser/cxx1z-class-template-argument-deduction.cpp')
-rw-r--r-- | clang/test/Parser/cxx1z-class-template-argument-deduction.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp b/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp index bf1d004c8d2..532c893f213 100644 --- a/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp +++ b/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp @@ -137,7 +137,6 @@ namespace expr { (void)A{n}; (void)new A(n); (void)new A{n}; - // FIXME: We should diagnose the lack of an initializer here. (void)new A; } } @@ -150,7 +149,7 @@ namespace decl { auto k() -> A; // expected-error{{requires template arguments}} - A a; // expected-error {{declaration of variable 'a' with deduced type 'A' requires an initializer}} + A a; A b = 0; const A c = 0; A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}} |