brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 6ffb3a5 Raw
40 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++98-compat-pedantic -verify %s2// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++98-compat-pedantic -Wno-bind-to-temporary-copy -Wno-unnamed-type-template-args -Wno-local-type-template-args -Wno-binary-literal -Werror %s3 4template<typename T> int TemplateFn(T) { return 0; }5void LocalTemplateArg() {6  struct S {};7  TemplateFn(S()); // expected-warning {{local type 'S' as template argument is incompatible with C++98}}8                   // expected-note@-1 {{while substituting deduced template arguments}}9}10struct {} obj_of_unnamed_type; // expected-note {{here}}11int UnnamedTemplateArg = TemplateFn(obj_of_unnamed_type); // expected-warning {{unnamed type as template argument is incompatible with C++98}}12                                                          // expected-note@-1 {{while substituting deduced template arguments}}13 14namespace CopyCtorIssues {15  struct Private {16    Private();17  private:18    Private(const Private&); // expected-note {{declared private here}}19  };20  struct NoViable {21    NoViable(); // expected-note {{not viable}}22    NoViable(NoViable&); // expected-note {{not viable}}23  };24  struct Ambiguous {25    Ambiguous();26    Ambiguous(const Ambiguous &, int = 0); // expected-note {{candidate}}27    Ambiguous(const Ambiguous &, double = 0); // expected-note {{candidate}}28  };29  struct Deleted {30    Private p; // expected-note {{copy constructor of 'Deleted' is implicitly deleted because field 'p' has an inaccessible copy constructor}}31  };32 33  const Private &a = Private(); // expected-warning {{copying variable of type 'Private' when binding a reference to a temporary would invoke an inaccessible constructor in C++98}}34  const NoViable &b = NoViable(); // expected-warning {{copying variable of type 'NoViable' when binding a reference to a temporary would find no viable constructor in C++98}}35  const Ambiguous &c = Ambiguous(); // expected-warning {{copying variable of type 'Ambiguous' when binding a reference to a temporary would find ambiguous constructors in C++98}}36  const Deleted &d = Deleted(); // expected-warning {{copying variable of type 'Deleted' when binding a reference to a temporary would invoke a deleted constructor in C++98}}37 38  int n = 0b00100101001; // expected-warning {{binary integer literals are incompatible with C++ standards before C++14}}39}40