diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2015-09-14 07:05:00 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2015-09-14 07:05:00 +0000 |
| commit | 7eddcff8fa2722bca96e38b7a01c1963e25a49cf (patch) | |
| tree | 03d8a69ddc4142bf3c8830f72f51212392b5e377 /clang/test | |
| parent | 98800d9c3ac013d13fefcf5260068839cbc8881e (diff) | |
| download | bcm5719-llvm-7eddcff8fa2722bca96e38b7a01c1963e25a49cf.tar.gz bcm5719-llvm-7eddcff8fa2722bca96e38b7a01c1963e25a49cf.zip | |
[Sema] Reject value-initialization of function types
T in the expression T() must be a non-array complete object type or
the void type. Function types are neither.
This fixes PR24798.
llvm-svn: 247535
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/type-convert-construct.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/type-convert-construct.cpp b/clang/test/SemaCXX/type-convert-construct.cpp index 479af21476b..2dec50abebf 100644 --- a/clang/test/SemaCXX/type-convert-construct.cpp +++ b/clang/test/SemaCXX/type-convert-construct.cpp @@ -5,6 +5,8 @@ void f() { int v2 = typeof(int)(1,2); // expected-error {{excess elements in scalar initializer}} typedef int arr[]; int v3 = arr(); // expected-error {{array types cannot be value-initialized}} + typedef void fn_ty(); + fn_ty(); // expected-error {{function types cannot be value-initialized}} int v4 = int(); int v5 = int; // expected-error {{expected '(' for function-style cast or type construction}} typedef int T; |

