Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * Test for project issue #386. 11 : : */ 12 : : #include <cvc5/cvc5.h> 13 : : 14 : : #include <cassert> 15 : : 16 : : using namespace cvc5; 17 : : 18 : 1 : int main(void) 19 : : { 20 : 1 : TermManager tm; 21 : : 22 : 1 : Sort s1 = tm.getBooleanSort(); 23 : 1 : Sort p1 = tm.mkParamSort("_p1"); 24 : 1 : Sort p2 = tm.mkParamSort("_p2"); 25 : 4 : DatatypeDecl dtdecl = tm.mkDatatypeDecl("_x0", {p1, p2}); 26 : 2 : DatatypeConstructorDecl ctordecl = tm.mkDatatypeConstructorDecl("_x1"); 27 : 1 : ctordecl.addSelector("_x2", p1); 28 : 1 : dtdecl.addConstructor(ctordecl); 29 : 1 : Sort s2 = tm.mkDatatypeSort(dtdecl); 30 : : try 31 : : { 32 [ - - ][ + + ]: 5 : s2.instantiate({s1}); 33 : : } 34 [ - + ]: 1 : catch (CVC5ApiException& e) 35 : : { 36 : 1 : return 0; 37 : 1 : } 38 : 0 : assert(false); 39 : 1 : }