| Richard Smith | f679b5b | 2011-10-14 20:48:27 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -verify %s | 
| Richard Smith | 2b6b0ee | 2011-10-14 20:41:13 +0000 | [diff] [blame] | 2 |  | 
|  | 3 | template<typename ...T>  // expected-warning {{variadic templates are incompatible with C++98}} | 
|  | 4 | class Variadic1 {}; | 
|  | 5 |  | 
|  | 6 | template<template<typename> class ...T>  // expected-warning {{variadic templates are incompatible with C++98}} | 
|  | 7 | class Variadic2 {}; | 
|  | 8 |  | 
|  | 9 | template<int ...I>  // expected-warning {{variadic templates are incompatible with C++98}} | 
|  | 10 | class Variadic3 {}; | 
| Richard Smith | f679b5b | 2011-10-14 20:48:27 +0000 | [diff] [blame] | 11 |  | 
|  | 12 | int alignas(8) with_alignas; // expected-warning {{'alignas' is incompatible with C++98}} | 
|  | 13 | int with_attribute [[ ]]; // expected-warning {{attributes are incompatible with C++98}} | 
| Richard Smith | acd4d3d | 2011-10-15 01:18:56 +0000 | [diff] [blame] | 14 |  | 
|  | 15 | void Literals() { | 
|  | 16 | (void)u8"str"; // expected-warning {{unicode literals are incompatible with C++98}} | 
|  | 17 | (void)u"str"; // expected-warning {{unicode literals are incompatible with C++98}} | 
|  | 18 | (void)U"str"; // expected-warning {{unicode literals are incompatible with C++98}} | 
|  | 19 | (void)u'x'; // expected-warning {{unicode literals are incompatible with C++98}} | 
|  | 20 | (void)U'x'; // expected-warning {{unicode literals are incompatible with C++98}} | 
|  | 21 |  | 
|  | 22 | (void)u8R"X(str)X"; // expected-warning {{raw string literals are incompatible with C++98}} | 
|  | 23 | (void)uR"X(str)X"; // expected-warning {{raw string literals are incompatible with C++98}} | 
|  | 24 | (void)UR"X(str)X"; // expected-warning {{raw string literals are incompatible with C++98}} | 
|  | 25 | (void)R"X(str)X"; // expected-warning {{raw string literals are incompatible with C++98}} | 
|  | 26 | (void)LR"X(str)X"; // expected-warning {{raw string literals are incompatible with C++98}} | 
|  | 27 | } | 
|  | 28 |  | 
|  | 29 | template<typename T> struct S {}; | 
| Richard Smith | 5d164bc | 2011-10-15 05:09:34 +0000 | [diff] [blame] | 30 | namespace TemplateParsing { | 
|  | 31 | S<::S<void> > s; // expected-warning {{'<::' is treated as digraph '<:' (aka '[') followed by ':' in C++98}} | 
|  | 32 | S< ::S<void>> t; // expected-warning {{consecutive right angle brackets are incompatible with C++98 (use '> >')}} | 
|  | 33 | } | 
|  | 34 |  | 
|  | 35 | void Lambda() { | 
|  | 36 | []{}; // expected-warning {{lambda expressions are incompatible with C++98}} | 
|  | 37 | } | 
|  | 38 |  | 
|  | 39 | int InitList() { | 
|  | 40 | (void)new int {}; // expected-warning {{generalized initializer lists are incompatible with C++98}} | 
|  | 41 | (void)int{}; // expected-warning {{generalized initializer lists are incompatible with C++98}} | 
|  | 42 | int x {}; // expected-warning {{generalized initializer lists are incompatible with C++98}} | 
|  | 43 | return {}; // expected-warning {{generalized initializer lists are incompatible with C++98}} | 
|  | 44 | } | 
|  | 45 |  | 
|  | 46 | int operator""_hello(const char *); // expected-warning {{literal operators are incompatible with C++98}} | 
|  | 47 |  | 
|  | 48 | enum EnumFixed : int { // expected-warning {{enumeration types with a fixed underlying type are incompatible with C++98}} | 
|  | 49 | }; | 
|  | 50 |  | 
|  | 51 | enum class EnumScoped { // expected-warning {{scoped enumerations are incompatible with C++98}} | 
|  | 52 | }; | 
|  | 53 |  | 
|  | 54 | void Deleted() = delete; // expected-warning {{deleted function definitions are incompatible with C++98}} | 
|  | 55 | struct Defaulted { | 
|  | 56 | Defaulted() = default; // expected-warning {{defaulted function definitions are incompatible with C++98}} | 
|  | 57 | }; | 
|  | 58 |  | 
|  | 59 | int &&RvalueReference = 0; // expected-warning {{rvalue references are incompatible with C++98}} | 
|  | 60 | struct RefQualifier { | 
|  | 61 | void f() &; // expected-warning {{reference qualifiers on functions are incompatible with C++98}} | 
|  | 62 | }; | 
|  | 63 |  | 
|  | 64 | auto f() -> int; // expected-warning {{trailing return types are incompatible with C++98}} | 
|  | 65 |  | 
|  | 66 | void RangeFor() { | 
|  | 67 | int xs[] = {1, 2, 3}; | 
|  | 68 | for (int &a : xs) { // expected-warning {{range-based for loop is incompatible with C++98}} | 
|  | 69 | } | 
|  | 70 | } | 
|  | 71 |  | 
|  | 72 | struct InClassInit { | 
|  | 73 | int n = 0; // expected-warning {{in-class initialization of non-static data members is incompatible with C++98}} | 
|  | 74 | }; | 
|  | 75 |  | 
|  | 76 | struct OverrideControlBase { | 
|  | 77 | virtual void f(); | 
|  | 78 | virtual void g(); | 
|  | 79 | }; | 
|  | 80 | struct OverrideControl final : OverrideControlBase { // expected-warning {{'final' keyword is incompatible with C++98}} | 
|  | 81 | virtual void f() override; // expected-warning {{'override' keyword is incompatible with C++98}} | 
|  | 82 | virtual void g() final; // expected-warning {{'final' keyword is incompatible with C++98}} | 
|  | 83 | }; | 
|  | 84 |  | 
|  | 85 | using AliasDecl = int; // expected-warning {{alias declarations are incompatible with C++98}} | 
|  | 86 | template<typename T> using AliasTemplate = T; // expected-warning {{alias declarations are incompatible with C++98}} | 
|  | 87 |  | 
|  | 88 | inline namespace N { // expected-warning {{inline namespaces are incompatible with C++98}} | 
|  | 89 | } | 
| Richard Smith | e41fac2 | 2011-10-15 05:42:01 +0000 | [diff] [blame^] | 90 |  | 
|  | 91 | auto auto_deduction = 0; // expected-warning {{'auto' type specifier is incompatible with C++98}} | 
|  | 92 | int *p = new auto(0); // expected-warning {{'auto' type specifier is incompatible with C++98}} |