diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CXX/drs/dr19xx.cpp | 9 | ||||
| -rw-r--r-- | clang/test/Parser/MicrosoftExtensions.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/builtin-constant-p.cpp | 5 | ||||
| -rw-r--r-- | clang/test/SemaCXX/typeid.cpp | 5 | 
4 files changed, 18 insertions, 3 deletions
| diff --git a/clang/test/CXX/drs/dr19xx.cpp b/clang/test/CXX/drs/dr19xx.cpp index a1e8c764354..4e359681fa8 100644 --- a/clang/test/CXX/drs/dr19xx.cpp +++ b/clang/test/CXX/drs/dr19xx.cpp @@ -167,9 +167,14 @@ namespace dr1959 { // dr1959: 3.9  #endif  } -namespace dr1968 { // dr1968: yes +namespace dr1968 { // dr1968: no  #if __cplusplus >= 201103L -  static_assert(&typeid(int) == &typeid(int), ""); // expected-error{{not an integral constant expression}} +  // FIXME: According to DR1968, both of these should be considered +  // non-constant. +  static_assert(&typeid(int) == &typeid(int), ""); + +  constexpr const std::type_info *f() { return &typeid(int); } +  static_assert(f() == f(), "");  #endif  } diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp index 63e8b608239..913645b6891 100644 --- a/clang/test/Parser/MicrosoftExtensions.cpp +++ b/clang/test/Parser/MicrosoftExtensions.cpp @@ -138,6 +138,8 @@ typedef COM_CLASS_TEMPLATE_REF<struct_with_uuid, __uuidof(struct_with_uuid)> COM  COM_CLASS_TEMPLATE_REF<int, __uuidof(struct_with_uuid)> good_template_arg;  COM_CLASS_TEMPLATE<int, __uuidof(struct_with_uuid)> bad_template_arg; // expected-error {{non-type template argument of type 'const _GUID' is not a constant expression}} +// expected-note@-1 {{read of object '__uuidof(struct_with_uuid)' whose value is not known}} +// expected-note@-2 {{temporary created here}}  namespace PR16911 {  struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid; diff --git a/clang/test/SemaCXX/builtin-constant-p.cpp b/clang/test/SemaCXX/builtin-constant-p.cpp index 21cbaf7c699..f70676d250e 100644 --- a/clang/test/SemaCXX/builtin-constant-p.cpp +++ b/clang/test/SemaCXX/builtin-constant-p.cpp @@ -130,3 +130,8 @@ constexpr int mutate6(bool mutate) {  static_assert(mutate6(false) == 11);  // Mutation of state outside __builtin_constant_p: evaluates to false.  static_assert(mutate6(true) == 10); + +// GCC strangely returns true for the address of a type_info object, despite it +// not being a pointer to the start of a string literal. +namespace std { struct type_info; } +static_assert(__builtin_constant_p(&typeid(int))); diff --git a/clang/test/SemaCXX/typeid.cpp b/clang/test/SemaCXX/typeid.cpp index 48fcce0b492..4e696deee13 100644 --- a/clang/test/SemaCXX/typeid.cpp +++ b/clang/test/SemaCXX/typeid.cpp @@ -6,7 +6,7 @@ void f()  }  namespace std { -  class type_info; +  struct type_info { const char *name; };  }  void g() @@ -27,3 +27,6 @@ void h(int i) {    typeid(V);        // expected-error{{'typeid' of variably modified type 'char [i]'}}    typeid(char [i]); // expected-error{{'typeid' of variably modified type 'char [i]'}}  } + +// expected-note@+1 {{read of object 'typeid(int).name' whose value is not known}} +constexpr const char *name = typeid(int).name; // expected-error {{constant expression}} | 

