Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/concepts/generic-fn-err.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
line wrap: on
line source
// { dg-do compile { target c++17_only } } // { dg-options "-fconcepts" } template<typename T> concept bool C() { return __is_class(T); } template<int N> concept bool Int() { return true; } template<template<typename> class X> concept bool Template() { return true; } void f1(Int) { } // { dg-error "does not constrain a type" } void f2(Template) { } // { dg-error "does not constrain a type" } struct S { }; struct S1 { void f1(auto x) { } void f2(C x) { } void f3(auto x) { } void f3(C x) { } }; template<C T> struct S2 { void f1(auto x) { } void f2(C x) { } void h1(auto x); void h2(C x); template<C U> void g(T t, U u) { } }; int main() { S s; S1 s1; s1.f2(0); // { dg-error "matching" } S2<S> s2; s2.f2(0); // { dg-error "matching" } s2.h2(0); // { dg-error "matching" } s2.g(s, 0); // { dg-error "matching" } s2.g(0, s); // { dg-error "matching" } }