diff options
author | Hans Wennborg <hans@hanshq.net> | 2018-02-14 09:06:43 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2018-02-14 09:06:43 +0000 |
commit | 4a0ce84710b48d724e67ec29e71da5f6accf01be (patch) | |
tree | b497d9309becb3922d56bb1d2c920d0b472b00b3 /test | |
parent | 4a005620928c39874a0177ec97d84e636ab8dbfc (diff) |
Merging r323998:
------------------------------------------------------------------------
r323998 | rsmith | 2018-02-01 21:01:49 +0100 (Thu, 01 Feb 2018) | 5 lines
PR36157: When injecting an implicit function declaration in C89, find the right
DeclContext rather than injecting it wherever we happen to be.
This avoids creating functions whose DeclContext is a struct or similar.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_60@325104 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Sema/bitfield.c | 4 | ||||
-rw-r--r-- | test/Sema/cxx-as-c.c | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/test/Sema/bitfield.c b/test/Sema/bitfield.c index d625366e4e..13e9480a37 100644 --- a/test/Sema/bitfield.c +++ b/test/Sema/bitfield.c @@ -82,3 +82,7 @@ typedef __typeof__(+(t5.n--)) Unsigned; // also act like compound-assignment. struct Test6 { : 0.0; // expected-error{{type name requires a specifier or qualifier}} }; + +struct PR36157 { + int n : 1 ? 1 : implicitly_declare_function(); // expected-warning {{invalid in C99}} +}; diff --git a/test/Sema/cxx-as-c.c b/test/Sema/cxx-as-c.c new file mode 100644 index 0000000000..41d7350d1f --- /dev/null +++ b/test/Sema/cxx-as-c.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -verify + +// PR36157 +struct Foo { + Foo(int n) : n_(n) {} // expected-error 1+{{}} expected-warning 1+{{}} +private: + int n; +}; +int main() { Foo f; } // expected-error 1+{{}} |