diff options
| author | Richard Trieu <rtrieu@google.com> | 2016-10-01 00:15:24 +0000 |
|---|---|---|
| committer | Richard Trieu <rtrieu@google.com> | 2016-10-01 00:15:24 +0000 |
| commit | c2265be1860bf8c44e6d867485452fcdb8e7e8ae (patch) | |
| tree | 2a1bf3df84cae57035c1ec75145abcbb6b48fc6e /clang/test/SemaCXX/cxx0x-defaulted-functions.cpp | |
| parent | 6610b01a278198fecf79503c1761eabbf60d56f2 (diff) | |
| download | bcm5719-llvm-c2265be1860bf8c44e6d867485452fcdb8e7e8ae.tar.gz bcm5719-llvm-c2265be1860bf8c44e6d867485452fcdb8e7e8ae.zip | |
Fix crash when emitting error.
With templated classes, is possible to not be able to determine is a member
function is a special member function before the class is instantiated. Only
these special member functions can be defaulted. In some cases, knowing
whether a function is a special member function can't be determined until
instantiation, so an uninstantiated function could possibly be defaulted too.
Add a case to the error diagnostic when the function marked with a default is
not known to be a special member function.
llvm-svn: 282989
Diffstat (limited to 'clang/test/SemaCXX/cxx0x-defaulted-functions.cpp')
| -rw-r--r-- | clang/test/SemaCXX/cxx0x-defaulted-functions.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp b/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp index 08d5dbd285d..7ec9726095c 100644 --- a/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp +++ b/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp @@ -234,4 +234,12 @@ template<bool B> struct X { X<true> x1; X<false> x2; // expected-note {{in instantiation}} +template <typename Type> +class E { + explicit E(const int &) = default; +}; + +template <typename Type> +E<Type>::E(const int&) {} // expected-error {{definition of explicitly defaulted function}} + } |

