brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 3f8282d Raw
103 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wno-unused2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wno-unused -fms-compatibility -DMSVC3 4namespace PR8446_1 {5struct A {6  typedef int BASE_VALUE;7};8 9void g(int &y) {}10 11template <typename BASE_CLASS>12void f(int &rValue) {13#if MSVC14// expected-warning@+4 {{missing 'typename' prior to dependent type name 'BASE_CLASS::BASE_VALUE'}}15#else16  // expected-error@+2 {{expected expression}}17#endif18  return g((BASE_CLASS::BASE_VALUE &)rValue);19}20 21int main() {22  int x;23  f<A>(x);24  return 0;25}26} // namespace PR8446_127 28 29namespace PR8446_2 {30struct site_symmetry_ops {};31 32template <class wt>33struct class_ {34  template <class A1>35  void def(A1 const &a1) {}36};37 38template <class A1, class A2>39struct init {40  init() {}41};42 43struct special_position_site_parameter {44  typedef char scatterer_type;45};46 47template <class wt>48struct valued_asu_parameter_heir_wrapper {49  static class_<wt> wrap(char const *name) {50    return class_<wt>();51  }52};53 54template <class wt>55struct special_position_wrapper {56  static void wrap(char const *name) {57    valued_asu_parameter_heir_wrapper<wt>::wrap(name)58#if MSVC59    // expected-warning@+4 {{missing 'typename' prior to dependent type name 'wt::scatterer_type'}}60#else61    // expected-error@+2 {{expected expression}}62#endif63        .def(init<site_symmetry_ops const &, wt::scatterer_type *>());64  }65};66 67void wrap_special_position() {68  special_position_wrapper<special_position_site_parameter>::wrap("special_position_site_parameter");69}70} // namespace PR8446_271 72namespace PR8446_3 {73int g(int);74template <typename T>75int f1(int x) {76  return g((T::InnerName & x) & x);77}78 79template <typename T>80int f2(int x) {81  return g((T::InnerName & 3) & x);82}83 84template <typename T>85int f3(int x) {86  return g((T::InnerName & (3)));87}88 89template <typename T>90int f4(int x) {91  return g((T::InnerName * 3) & x);92}93struct A {94  static const int InnerName = 42;95};96int main() {97  f1<A>(0);98  f2<A>(0);99  f3<A>(0);100  return f4<A>(0);101}102} // namespace PR8446_3103