2014-06-24 Andrew Sutton <andrew.n.sutton@gmail.com>
[official-gcc.git] / gcc / testsuite / g++.dg / concepts / mem-concept-err.C
blobfcdd016951847004758a2126048e3ca6b473f53b
1 // { dg-options "-std=c++1y" }
4 // The following error is emitted without context. I'm not
5 // certain why that would be the case. It comes as a result
6 // of failing the declaration of S::f0().
7 //
8 //    cc1plus: error: expected ';' at end of member declaration
11 struct Base {
12   template<typename T, typename U>
13     bool C() const { return false; } // Not a concept!
15   template<typename T>
16     static concept bool D() { return __is_same_as(T, int); }
18   template<typename T, typename U>
19     static concept bool E() { return __is_same_as(T, U); }
22 void f1(Base::D) { }
23 void f2(Base::E<double> x) { }
25 template<typename T>
26   struct S : Base {
27     void f0(Base::C<float> x) { } // { dg-error "expected|type" }
28     void f1(Base::D) { }
29     void f2(Base::E<T> x) { }
30   };
32 int main() { 
33   f1('a'); // { dg-error "matching" }
34   f2(0);   // { dg-error "matching" }
36   S<int> s;
37   s.f1('a'); // { dg-error "matching" }
38   s.f2('a'); // { dg-error "matching" }