diff options
Diffstat (limited to 'test/SemaCXX')
| -rw-r--r-- | test/SemaCXX/constant-expression.cpp | 11 | ||||
| -rw-r--r-- | test/SemaCXX/new-delete-cxx0x.cpp | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/test/SemaCXX/constant-expression.cpp b/test/SemaCXX/constant-expression.cpp index f82a69209379..69e846bf0ec2 100644 --- a/test/SemaCXX/constant-expression.cpp +++ b/test/SemaCXX/constant-expression.cpp @@ -143,3 +143,14 @@ namespace rdar16064952 { } char PR17381_ice = 1000000 * 1000000; // expected-warning {{overflow}} expected-warning {{changes value}} + +namespace PR31701 { + struct C { + template<int i> static int n; // expected-warning {{extension}} + }; + template <int M> class D; + template <int M> + template<int i> void D<M>::set() { // expected-error {{from class 'D<M>' without definition}} + const C c = C::n<i>; + } +} diff --git a/test/SemaCXX/new-delete-cxx0x.cpp b/test/SemaCXX/new-delete-cxx0x.cpp index c55152510e1b..4ef586f2e565 100644 --- a/test/SemaCXX/new-delete-cxx0x.cpp +++ b/test/SemaCXX/new-delete-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -triple=i686-pc-linux-gnu +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -triple=i686-pc-linux-gnu -pedantic void ugly_news(int *ip) { (void)new int[-1]; // expected-error {{array size is negative}} @@ -29,6 +29,7 @@ void fn(int n) { (void) new int[2] {1, 2}; (void) new S[2] {1, 2}; (void) new S[3] {1, 2}; + (void) new S[n] {}; // C++11 [expr.new]p19: // If the new-expression creates an object or an array of objects of class // type, access and ambiguity control are done for the allocation function, @@ -44,6 +45,7 @@ void fn(int n) { (void) new T[2] {1, 2}; // ok (void) new T[3] {1, 2}; // expected-error {{no matching constructor}} expected-note {{in implicit initialization of array element 2}} (void) new T[n] {1, 2}; // expected-error {{no matching constructor}} expected-note {{in implicit initialization of trailing array elements in runtime-sized array new}} + (void) new T[n] {}; // expected-error {{no matching constructor}} expected-note {{in implicit initialization of trailing array elements in runtime-sized array new}} } struct U { |
